BatchLabs / headers-bundle

A Symfony bundle to easily add headers to your responses.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Batch Headers Bundle

A Symfony bundle to ease the configuration of global response headers. Instead of creating a response listener to add custom headers, use a configuration file:

batch_headers:
  headers:
    # Apply a CSP on all the responses
    - Content-Security-Policy: default-src 'self'

    # Allow your API to be requested from all origins
    - name: Access-Control-Allow-Origin
      value: "*"
      condition: request.getPathInfo() matches '^/api'

    # Always cache images
    - name: Cache-Control
      value: max-age=31536000, public
      condition: response.headers.get('Content-Type') matches '^image/'

Installation

$ composer require batch.com/headers-bundle

Read the documentation for complete instructions.

Documentation

Read the documentation in src/Resources/doc/

About

A Symfony bundle to easily add headers to your responses.

License:MIT License


Languages

Language:PHP 100.0%