Download the PHP package willdurand/stack-negotiation without Composer
On this page you can find all versions of the php package willdurand/stack-negotiation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download willdurand/stack-negotiation
More information about willdurand/stack-negotiation
Files in willdurand/stack-negotiation
Package stack-negotiation
Short Description Stack middleware for content negotiation.
License MIT
Informations about the package stack-negotiation
StackNegotiation
Stack middleware for content negotiation.
Installation
The recommended way to install StackNegotiation is through Composer:
Usage
Headers
Accept
Header
This middleware adds a _accept
attribute to the request, containing a
AcceptHeader
object (see:
Negotiation library). It also adds
a _mime_type
attribute containing the mime type if it is not a media range, as
well as a _format
attribute containing the preferred format value.
Accept-Language
Header
This middleware adds a _accept_language
attribute to the request, containing a
AcceptHeader
object (see:
Negotiation library). It also adds
a _language
attribute containing the value itself.
Content-Type
Header
This middleware is able to decode a request body, and fill in request data. It is inspired by Silex's recipe Accepting a JSON Request Body and FOSRestBundle Body Listener.
Options
You can pass an array of options to the middleware:
Unit Tests
Setup the test suite using Composer:
$ composer install --dev
Run it using PHPUnit:
$ ./vendor/bin/phpunit
Contributing
See CONTRIBUTING file.
License
StackNegotiation is released under the MIT License. See the bundled LICENSE file for details.