FyreNegotiate is a free, open-source HTTP negotiation library for PHP.
Using Composer
composer require fyre/negotiate
In PHP:
use Fyre\Http\Negotiate;Content
Negotiate a content type.
$acceptedis a string representing theAcceptheader.$supportedis an array containing the supported content values.$strictis a boolean indicating whether to not use a default fallback, and will default to false.
Negotiate::content($accepted, $supported, $strict);Encoding
Negotiate an encoding.
$acceptedis a string representing theAccept-Encodingheader.$supportedis an array containing the supported encoding values.
Negotiate::encoding($accepted, $supported);Language
Negotiate a language.
$acceptedis a string representing theAccept-Languageheader.$supportedis an array containing the supported language values.
Negotiate::language($accepted, $supported);