Cherry-project Request class

v1.1.0 2019-03-05 21:14 UTC

This package is auto-updated.

Last update: 2024-10-29 05:40:40 UTC


README

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