Download the PHP package libero/content-negotiation-bundle without Composer
On this page you can find all versions of the php package libero/content-negotiation-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download libero/content-negotiation-bundle
More information about libero/content-negotiation-bundle
Files in libero/content-negotiation-bundle
Package content-negotiation-bundle
Short Description Adds content negotiation to your Symfony application
License MIT
Informations about the package content-negotiation-bundle
ContentNegotiationBundle
This is a Symfony bundle that will add content negotiation to your application by integrating the Negotiation library.
Getting started
Using Composer you can add the bundle as a dependency:
If you're not using Symfony Flex, you'll need to enable the bundle in your application.
Path-based negotiation
You can add negotiation to paths through configuration.
For example, to add a requirement of XML or JSON and English or French to an exact path, and plain text and German elsewhere:
The formats
and locales
items are run in order. The first to match will be used.
priorities
may be empty, allowing for negotiation to be disabled at lower levels. For example, require English everywhere except under /foo
:
optional
may be set to true
to allow falling back to subsequent matches. For example, to require English everywhere except under /foo
, where either German or English is allowed:
Route-level negotiation
You can add negotiation at the route level by adding requirements for _format
and/or _locale
.
These requirements must be a list of possibilities separated by vertical bars.
For example, to add a requirement of XML or JSON and English or French to a route:
Route-level negotiation takes precedence over path-based.
Getting help
- Report a bug or request a feature on GitHub.
- Ask a question on the Libero Community Slack.
- Read the code of conduct.
All versions of content-negotiation-bundle with dependencies
symfony/config Version ^3.4 || ^4.0
symfony/dependency-injection Version ^3.4 || ^4.0
symfony/http-foundation Version ^3.4 || ^4.0
symfony/http-kernel Version ^3.4 || ^4.0
symfony/routing Version ^3.4 || ^4.0
willdurand/negotiation Version ^2.3