elife / content-negotiator
eLife Sciences content negotiator
Installs: 11 660
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 11
Forks: 0
Open Issues: 0
Requires
- php: ^7.1 || ^8.0
- symfony/http-foundation: ^3.4.35 || ^4.4
- symfony/http-kernel: ^3.4 || ^4.4
- willdurand/negotiation: ^2.0.2 || ^3.1
Requires (Dev)
- phpunit/phpunit: ^7.5 || ^9.6
- pimple/pimple: ^3.0
- silex/silex: ^2.0
- squizlabs/php_codesniffer: ^3.5
- symfony/browser-kit: ^3.4 || ^4.4
- symfony/css-selector: ^3.4 || ^4.4
- symfony/debug: ^3.4 || ^4.4
Suggests
- silex/silex: ^2.0, to use ContentNegotiationProvider
Conflicts
- sebastian/comparator: <1.2.3
This package is auto-updated.
Last update: 2024-10-31 12:29:05 UTC
README
This library provides a wrapper around Negotiation.
Dependencies
- Composer
- PHP 7
Installation
composer require elife/content-negotiator
Set up
Silex
use eLife\ContentNegotiator\Silex\ContentNegotiationProvider; use Negotiation\Accept; $app->register(new ContentNegotiationProvider()); $app->get('/path', function (Accept $accept) { return new Response("Negotiated {$accept->getNormalizedValue()}"); })->before($app['negotiate.accept']('text/plain', 'text/rtf'));
When using symfony/http-kernel
3.1+, you can type-hint an argument on your controller with one of the following types and the result of the negotiation will be used:
Running the tests
vendor/bin/phpunit