mb-webdev / optimization-bundle
An optimization bundle dedicated to simplify headers management and html compression
Installs: 130
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.3.2
- symfony/framework-bundle: 2.*
This package is not auto-updated.
Last update: 2022-02-01 12:55:09 UTC
README
MBOptimizationBundle is a small simple bundle which perform some optimization on the http response such adding security headers, compressing html, etc...
Installation
Step 1: Composer
First you need to add MB/optimization-bundle
to composer.json
:
{ "require": { "mb/optimization-bundle": "dev-master" } }
note: replace dev-master
with the last version of this bundle.
Step 2: AppKernel
Register the bundle into the Symfony AppKernel
// app/AppKernel.php class AppKernel extends Kernel { public function registerBundles() { $bundles = array( ... new MB\Bundle\OptimizationBundle\MBOptimizationBundle() ); return $bundles; } }
Step 3: Config
Define the configuration of the bundle into the config file
# app/config/config.yml mb_optimization: html_compress: false # optional : compress html output (spaghetti code) x_frame_options: enabled: false # required : enable/disable X-Frame-Options header value: SAMEORIGIN # optional : value of this header attribute (default value : "SAMEORIGIN") x_xss_protection: enabled: false # required : enable/disable X-XSS-Protection header value: "1; mode=block" # optional : value of this header attribute (default value : "1; mode=block") content_security_policy: enabled: false # required : enable/disable Content-Security-Policy header value: # optional : array of values for this header attribute (automatically add "self" to the list of sources) - "source1.com" - "source2.com" - "*.source3.com"