2017 © Pedro Peláez
 

symfony-bundle content-type-negotiation-bundle

Enables Symfony2 apps to serve different content types under the same URI based on the HTTP Accept header.

image

elseym/content-type-negotiation-bundle

Enables Symfony2 apps to serve different content types under the same URI based on the HTTP Accept header.

  • Friday, November 23, 2012
  • by PSeiffert
  • Repository
  • 3 Watchers
  • 1 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Symfony 2 Content Type Negotiation Bundle

This bundle can be used to enable a simple content type negotiation in Symfony2 applications. To use it, just include it as a dependency in your composer.json and register the bundle in your AppKernel:, (*1)

composer.json:, (*2)

...
"require": {
    ...
    "elseym/content-type-negotiation-bundle": "dev-master"
}
...

app/AppKernel.php:, (*3)

...
$bundles = array(
    ...
    new elseym\ContentTypeNegotiationBundle\elseymContentTypeNegotiationBundle(),
    ...
);

Usage

The key component of this bundle is an EventListener that registeres for kernel.controller events and selects the best suitable controller action for each request. This decision is based on the value of a requests Accept header., (*4)

For a request with an Accept header like this:, (*5)

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

The bundle would try to use one the following controller actions:, (*6)

  • indexActionHtmlText
  • indexActionHtml
  • indexActionXhtmlXmlApplication
  • indexActionXhtmlXml
  • indexActionXmlApplication
  • indexActionXml
  • indexAction

The Versions

23/11 2012

dev-master

9999999-dev http://github.com/elseym/content-type-negotiation-bundle

Enables Symfony2 apps to serve different content types under the same URI based on the HTTP Accept header.

  Sources   Download

Apache2

The Requires

 

by Paul Seiffert
by Simon Waibl

mime contenttype