tdt/negotiators
最新稳定版本:v1.0.2
Composer 安装命令:
composer require tdt/negotiators
包简介
A package to do content and language negotiation.
README 文档
README
Content and language negotiation written in PHP: GET parameters will overwrite accept header. Support for logging (monolog).
Installation
Install as a requirement using composer:
-
Add a composer.json in your root
-
Add a requirement:
{
"require" : {
"tdt/negotiators" : "1.0.*"
}
}
-
Install composer: http://getcomposer.com
-
run "composer install"
-
include vendor/autoload.php
Usage
$cn = new \tdt\negotiators\ContentNegotiator(); $format = $cn->pop(); $default_format = "json"; // $this->formatAllowed is a function you have to define yourself while (!$this->formatAllowed($format) && $cn->hasNext()) { $format = $cn->pop(); } if(! $this->formatAllowed($format)){ throw new Exception("Could not find an appropriate formatter."); } // use $format further on
Testing
Using phpunit:
$ phpunit tests
统计信息
- 总下载量: 863
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: AGPLv3
- 更新时间: 2013-01-19