Skip to content

cherry-framework/request

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cherry-Request

The Cherry-project Request wrapper

GitHub license

GitHub release

Packagist Version


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

MDN - HTTP 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