fyre / negotiate
A negotiation library.
Installs: 247
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/fyre/negotiate
Requires
- fyre/macro: ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.59
- fyre/php-cs-fixer-config: ^1.0
- phpunit/phpunit: ^12
README
FyreNegotiate is a free, open-source HTTP negotiation library for PHP.
Table Of Contents
Installation
Using Composer
composer require fyre/negotiate
In PHP:
use Fyre\Http\Negotiate;
Methods
Content
Negotiate a content type.
$accepted
is a string representing theAccept
header.$supported
is an array containing the supported content values.$strict
is a boolean indicating whether to not use a default fallback, and will default to false.
Negotiate::content($accepted, $supported, $strict);
Encoding
Negotiate an encoding.
$accepted
is a string representing theAccept-Encoding
header.$supported
is an array containing the supported encoding values.
Negotiate::encoding($accepted, $supported);
Language
Negotiate a language.
$accepted
is a string representing theAccept-Language
header.$supported
is an array containing the supported language values.
Negotiate::language($accepted, $supported);