vakata / http
HTTP Request / Response classes (extending Laminas/Diactoros with a few methods)
Installs: 4 061
Dependents: 1
Suggesters: 1
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=8.0.0
- vakata/laminas-diactoros-mutable: ^3.3
- dev-master
- 3.3.2
- 3.3.1
- 3.3.0
- 3.2.3
- 3.2.2
- 3.2.1
- 3.2.0
- 3.1.0
- 3.0.16
- 3.0.15
- 3.0.14
- 3.0.13
- 3.0.12
- 3.0.11
- 3.0.10
- 3.0.9
- 3.0.8
- 3.0.7
- 3.0.6
- 3.0.5
- 3.0.4
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 2.3.1
- 2.3.0
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0.1
- 2.0.0
- 1.3.13
- 1.3.12
- 1.3.11
- 1.3.10
- 1.3.9
- 1.3.8
- 1.3.7
- 1.3.6
- 1.3.5
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.1
- 1.2.0
- 1.1.0
- 1.0.14
- 1.0.13
- 1.0.12
- 1.0.11
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
This package is auto-updated.
Last update: 2024-10-30 15:23:50 UTC
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.