https://github.com/seeren/http
🌐 Http client and messages
https://github.com/seeren/http
client psr-18 psr-7 request response
Last synced: about 1 month ago
JSON representation
🌐 Http client and messages
- Host: GitHub
- URL: https://github.com/seeren/http
- Owner: seeren
- License: mit
- Created: 2016-10-17T20:13:40.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-01-07T20:19:43.000Z (over 4 years ago)
- Last Synced: 2025-09-17T23:59:52.877Z (9 months ago)
- Topics: client, psr-18, psr-7, request, response
- Language: PHP
- Homepage:
- Size: 247 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Seeren\\Http
[](https://app.travis-ci.com/seeren/http)
[](https://packagist.org/packages/seeren/http)
[](https://coveralls.io/github/seeren/http?branch=master)
[](https://packagist.org/packages/seeren/http/stats)
[](https://www.codacy.com/gh/seeren/http/dashboard?utm_source=github.com&utm_medium=referral&utm_content=seeren/http&utm_campaign=Badge_Grade)
[](https://packagist.org/packages/seeren/http)
Manage http messages
* * *
## Installation
Seeren\\Http is a [PSR-7 http messages interfaces](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-7-http-message.md)
and a [PSR-18 http client interfaces](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-18-http-client-meta.md)
implementation
```bash
composer require seeren/http
```
* * *
## Seeren\\Http\\Client
Retrieve response from sending request
```php
use Seeren\Http\Client\Client;
use Seeren\Http\Uri\Uri;
$client = new Client('GET', new Uri(
'https',
'packagist.org',
'packages/seeren/http.json'
));
echo $client->sendRequest()->getBody();
```
* * *
## Seeren\\Http\\Uri
Uri representation
```php
use Seeren\Http\Uri\Uri;
$uri = new Uri('http', 'host');
```
Handle incoming request Uri
```php
use Seeren\Http\Uri\RequestUri;
$uri = new RequestUri();
```
* * *
## Seeren\\Http\\Stream
Handle resource with open mode
```php
use Seeren\Http\Stream\Stream;
echo new Stream('some-url', Stream::MODE_R);
```
Handle input for all http methods
```php
use Seeren\Http\Stream\RequestStream;
echo new RequestStream();
```
Handle output
```php
use Seeren\Http\Stream\ResponseStream;
$stream = new ResponseStream();
$stream->write('Client output');
```
* * *
## Seeren\\Http\\Request\\Request
Server Request representation with json or form input body
```php
use Seeren\Http\Request\Request;
use Seeren\Http\Stream\RequestStream;
use Seeren\Http\Uri\RequestUri;
$request = new Request(
new RequestStream(),
new RequestUri()
);
```
* * *
## Seeren\\Http\\Response\\Response
Server response
```php
use Seeren\Http\Response\Response;
use Seeren\Http\Stream\ResponseStream;
$response = new Response(
new ResponseStream()
);
```
* * *
## License
This project is licensed under the [MIT](./LICENSE) License