Request PHP

[!NOTE]
This script is still under development.
composer require adampatterson/request
Usage
use Request\Request;
$name = Request::get('name');
$page = Request::get('page', 1);
$query = Request::all('GET');
$post = Request::all('POST');
if (Request::has('search')) {
}
$method = Request::method();
$ip = Request::ip();
$userAgent = Request::userAgent();
$uri = Request::uri();
$root = Request::root();
Method Proxying
The Request class proxies unknown method calls to the underlying Symfony HTTP Foundation Request instance. This allows you to use any method provided by Symfony's Request object.
use Request\Request;
$path = Request::getPathInfo();
$symfonyRequest = Request::instance();
Tests
composer install
composer test
Local Dev
Without needing to modify the composer.json file. Run from the theme root, this will symlink the package into the theme's vendor directory.
ln -s ~/Sites/packages/Request/ ./vendor/adampatterson/request
Otherwise, you can add the local package to your composer.json file.
"repositories": [
{
"type": "path",
"url": "/Sites/packages/request"
}
],