elife/content-negotiator
最新稳定版本:v1.2.1
Composer 安装命令:
composer require elife/content-negotiator
包简介
eLife Sciences content negotiator
README 文档
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:
| Negotiator | Type |
|---|---|
$app['negotiate.accept'] |
Negotiation\Accept |
$app['negotiate.accept_charset'] |
Negotiation\AcceptCharset |
$app['negotiate.accept_encoding'] |
Negotiation\AcceptEncoding |
$app['negotiate.accept_language'] |
Negotiation\AcceptLanguage |
Running the tests
vendor/bin/phpunit
统计信息
- 总下载量: 15.37k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-11-03