cherry-project / request
Cherry-project Request class
v1.1.0
2019-03-05 21:14 UTC
Requires
- php: >=5.6.0
This package is auto-updated.
Last update: 2024-08-29 04:57:54 UTC
README
The Cherry-project Request wrapper
Including
Install from composer composer require cherry-project/logger
Include Autoloader in your main file (Ex.: index.php)
require_once __DIR__ . '/vendor/autoload.php';
Class Request
Import class
use Cherry\HttpUtils\Request;
Crete class new object
$request = new Request();
Class Methods
getHeaders()
Get request HTTP Headers
Get all headers
$allHeaders = $request->getHeaders();
Get single header (Ex.: Host)
$singleHeader = $request->getHeaders('Host');
Get more then one header
$manyHeaders = $request->getHeaders(['Accept', 'Accept-Encoding']);
Allowed headers
getMethod()
Get request HTTP method
hasHeader($key)
Check if request has header
getPath()
Get request path(URL)
getScheme()
Get request scheme(http or https)
getQueryParams()
Get request query parameters
getQuery($key)
Get request query parameter by key
getData()
Get request data by method
2019 © Cherry-project