Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cherry-framework/request
Cherry-project Request class
https://github.com/cherry-framework/request
cherry composer request
Last synced: about 1 month ago
JSON representation
Cherry-project Request class
- Host: GitHub
- URL: https://github.com/cherry-framework/request
- Owner: cherry-framework
- License: mit
- Created: 2019-03-04T20:49:13.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-28T15:57:24.000Z (almost 6 years ago)
- Last Synced: 2024-07-23T01:12:39.485Z (5 months ago)
- Topics: cherry, composer, request
- Language: PHP
- Size: 16.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# cherry-Request
The Cherry-project Request wrapper[![GitHub license](https://img.shields.io/github/license/abgeo07/cherry-request.svg)](https://github.com/ABGEO07/cherry-request/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/release/abgeo07/cherry-request.svg)](https://github.com/ABGEO07/cherry-request/releases)
[![Packagist Version](https://img.shields.io/packagist/v/cherry-project/request.svg "Packagist Version")](https://packagist.org/packages/cherry-project/request "Packagist Version")
------------
## Including
**Install from composer** `composer require cherry-project/logger`**Include Autoloader in your main file** (Ex.: index.php)
```php
require_once __DIR__ . '/vendor/autoload.php';
```## Class Request
Import class
```php
use Cherry\HttpUtils\Request;
```
Crete class new object
```php
$request = new Request();
```### Class Methods
#### getHeaders()
Get request HTTP HeadersGet all headers
```php
$allHeaders = $request->getHeaders();
```
Get single header (Ex.: Host)
```php
$singleHeader = $request->getHeaders('Host');
```
Get more then one header
```php
$manyHeaders = $request->getHeaders(['Accept', 'Accept-Encoding']);
```##### Allowed headers
[MDN - HTTP headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/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**