mb-webdev/optimization-bundle

This package is abandoned and no longer maintained. No replacement package was suggested.

An optimization bundle dedicated to simplify headers management and html compression

1.0.2 2016-01-29 10:39 UTC

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...

SensioLabsInsight

Latest Stable Version License

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"