https://github.com/elusivecodes/fyrerequest
FyreRequest is a free, open-source HTTP request library for PHP.
https://github.com/elusivecodes/fyrerequest
http message php request
Last synced: 7 months ago
JSON representation
FyreRequest is a free, open-source HTTP request library for PHP.
- Host: GitHub
- URL: https://github.com/elusivecodes/fyrerequest
- Owner: elusivecodes
- License: mit
- Created: 2021-12-08T09:29:15.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-27T12:44:28.000Z (8 months ago)
- Last Synced: 2024-10-28T15:45:37.122Z (7 months ago)
- Topics: http, message, php, request
- Language: PHP
- Homepage:
- Size: 49.8 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FyreRequest
**FyreRequest** is a free, open-source immutable HTTP request library for *PHP*.
## Table Of Contents
- [Installation](#installation)
- [Basic Usage](#basic-usage)
- [Methods](#methods)## Installation
**Using Composer**
```
composer require fyre/request
```In PHP:
```php
use Fyre\Http\Request;
```## Basic Usage
- `$uri` is a [*Uri*](https://github.com/elusivecodes/FyreURI) and will default to *null*.
- `$options` is an array containing the message options.
- `method` is a string representing the request method, and will default to "*get*".
- `body` is a string representing the message body, and will default to "".
- `headers` is an array containing headers to set, and will default to *[]*.
- `protocolVersion` is a string representing the protocol version, and will default to "*1.1*".```php
$request = new Request($uri, $options);
```## Methods
This class extends the [*Message*](https://github.com/elusivecodes/FyreMessage) class.
**Get Method**
Get the request method.
```php
$method = $request->getMethod();
```**Get Uri**
Get the request URI.
```php
$uri = $request->getUri();
```This method will return a [*Uri*](https://github.com/elusivecodes/FyreURI).
**Set Method**
Set the request method.
- `$method` is a string representing the request method.
```php
$newRequest = $request->setMethod($method);
```**Set Uri**
Set the request URI.
- `$uri` is a [*Uri*](https://github.com/elusivecodes/FyreURI).
```php
$newRequest = $request->setUri($uri);
```