elife / content-negotiator
eLife Sciences content negotiator
Installs: 12 847
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 11
Forks: 0
Open Issues: 4
Requires
- php: ^7.1 || ^8.0
- symfony/http-foundation: ^3.4.35 || ^4.4 || ^5.0
- symfony/http-kernel: ^3.4 || ^4.4 || ^5.0
- willdurand/negotiation: ^2.0.2 || ^3.1
Requires (Dev)
- phpunit/phpunit: ^7.5 || ^9.6
- pimple/pimple: ^3.0
- silexandfriends/silex: ^2.2 || ^3.0
- squizlabs/php_codesniffer: ^3.5
- symfony/browser-kit: ^4.4 || ^5.0
- symfony/css-selector: ^4.4 || ^5.0
- symfony/debug: ^4.4 || ^5.0
Suggests
- silex/silex: ^2.0, to use ContentNegotiationProvider
Conflicts
- sebastian/comparator: <1.2.3
This package is auto-updated.
Last update: 2024-12-17 08:02:40 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