2017 © Pedro Peláez
 

library stack-negotiation

Stack middleware for content negotiation.

image

willdurand/stack-negotiation

Stack middleware for content negotiation.

  • Monday, April 13, 2015
  • by couac
  • Repository
  • 5 Watchers
  • 26 Stars
  • 1,556 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 8 Forks
  • 1 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

StackNegotiation

Build
Status Latest Stable
Version, (*1)

Stack middleware for content negotiation., (*2)

Installation

The recommended way to install StackNegotiation is through Composer:, (*3)

``` bash $ composer require "willdurand/stack-negotiation", (*4)



Usage ----- ```php use Negotiation\Stack\Negotiation; $app = new Negotiation($app);

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., (*5)

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., (*6)

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., (*7)

Options

You can pass an array of options to the middleware:, (*8)

$app = new Negotiation($app, null, null, null, [
    'language_priorities' => [ '... '],
    'format_priorities'   => [ '... '],
]);

Unit Tests

Setup the test suite using Composer:, (*9)

$ composer install --dev

Run it using PHPUnit:, (*10)

$ ./vendor/bin/phpunit

Contributing

See CONTRIBUTING file., (*11)

License

StackNegotiation is released under the MIT License. See the bundled LICENSE file for details., (*12)

The Versions

13/04 2015

dev-master

9999999-dev

Stack middleware for content negotiation.

  Sources   Download

MIT

The Requires

 

The Development Requires

28/10 2014

v1.0.0

1.0.0.0

Stack middleware for content negotiation.

  Sources   Download

MIT

The Requires

 

The Development Requires

22/01 2014

0.1.0

0.1.0.0

Stack middleware for content negotiation.

  Sources   Download

MIT

The Requires

 

The Development Requires

22/12 2013

0.0.3

0.0.3.0

Stack middleware for content negotiation.

  Sources   Download

MIT

The Requires

 

The Development Requires

21/12 2013

0.0.2

0.0.2.0

Stack middleware for content negotiation.

  Sources   Download

MIT

The Requires

 

The Development Requires

21/12 2013

0.0.1

0.0.1.0

Stack middleware for content negotiation.

  Sources   Download

MIT

The Requires

 

The Development Requires