Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Content Type Negotiation Bundle Laravel Package

elseym/content-type-negotiation-bundle

View on GitHub
Deep Wiki
Context7

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:

composer.json:

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

app/AppKernel.php:

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

For a request with an Accept header like this:

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:

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

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator
equipc/laravel-email-database-log
adedsec/nova-translated-labels