elife / content-negotiator
eLife Sciences content negotiator
Installs: 10 686
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 11
Forks: 0
Open Issues: 0
Requires
- php: ^7.0
- symfony/http-foundation: ^2.7 || ^3.0
- symfony/http-kernel: ^2.7 || ^3.0
- willdurand/negotiation: ^2.0.2
Requires (Dev)
- phpunit/phpunit: ^5.7.7 || ^6.0
- pimple/pimple: ^3.0
- silex/silex: ^2.0
- symfony/browser-kit: ^2.7 || ^3.0
- symfony/css-selector: ^2.7 || ^3.0
- symfony/debug: ^2.8 || ^3.0
Suggests
- silex/silex: ^2.0, to use ContentNegotiationProvider
This package is auto-updated.
Last update: 2024-09-12 02:38:11 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