Download the PHP package willdurand/negotiation without Composer
On this page you can find all versions of the php package willdurand/negotiation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
More information about willdurand/negotiation
Files in willdurand/negotiation
Informations about the package negotiation
Negotiation is a standalone library without any dependencies that allows you to implement content negotiation in your application, whatever framework you use. This library is based on RFC 7231. Negotiation is easy to use, and extensively unit tested!
Important: You are browsing the documentation of Negotiation 3.x+.
Documentation for version 1.x is available here: Negotiation 1.x documentation.
Documentation for version 2.x is available here: Negotiation 2.x documentation.
The recommended way to install Negotiation is through Composer:
Media Type Negotiation
Negotiator returns an instance of
null if negotiating the
best media type has failed.
LanguageNegotiator returns an instance of
EncodingNegotiator returns an instance of
CharsetNegotiator returns an instance of
Accept* classes share common methods such as:
getValue()returns the accept value (e.g.
text/html; z=y; a=b; c=d)
getNormalizedValue()returns the value with parameters sorted (e.g.
text/html; a=b; c=d; z=y)
getQuality()returns the quality if available (
getType()returns the accept type (e.g.
getParameters()returns the set of parameters (excluding the
qparameter if provided)
getParameter()allows to retrieve a given parameter by its name. Fallback to a
$default(nullable) value otherwise.
hasParameter()indicates whether a parameter exists.
Negotiation follows Semantic Versioning.
End Of Life
has been released on November 26th, 2020. This is the current stable version
and it is in sync with the main branch (a.k.a.
Setup the test suite using Composer:
$ composer install --dev
Run it using PHPUnit:
See CONTRIBUTING file.
Some parts of this library are inspired by:
- William Durand
Negotiation is released under the MIT License. See the bundled LICENSE file for details.