vakata/http
最新稳定版本:3.3.10
Composer 安装命令:
composer require vakata/http
包简介
HTTP Request / Response classes (extending Laminas/Diactoros with a few methods)
README 文档
README
HTTP Request / Response classes, extending Zend Diactoros with just a few helful methods.
Install
Via Composer
$ composer require vakata/http
Usage
// REQUEST extras // create a request instance from the current client data $req = \vakata\http\Request::fromGlobals(); // now you can inspect properties $req->getQuery('asdf'); // get the "asdf" GET parameter value $req->getCookie('sessid'); // get the "sessid" cookie value $req->getPost('pass'); // get the "pass" POST parameter value $req->getPrefferedResponseLanguage(); // get the preffered response language // if a parameter is missing a default you pass in can be returned $req->getQuery('missing', 'default'); // now $a contains "default" // return values can also be filtered (all filters are listed in the docs) $req->getPost('user_id', null, 'int'); // you can also get the whole array of parameters $all = $req->getPost(); // URI extras $req->getUri()->getSegment(0); $req->getUri()->linkTo('some/path', [ 'get_param' => 'value' ]); // RESPONSE extras $res = new \vakata\http\Response(); $res = $res->expireCookie('sessid'); if ($res->hasCache()) { $res = $res->cacheUntil('+7 days'); } $res = $res->setContentTypeByExtension('json');
Read more in the API docs
Testing
$ composer test
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email github@vakata.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 5.83k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2016-01-03