seeren / http
Manage http server and client message
4.0.0
2022-01-07 20:19 UTC
Requires
- php: >=8.0.1
- psr/http-client: ^1.0.1
- psr/http-message: ~1.0.1
Requires (Dev)
- php-coveralls/php-coveralls: ^v2.5.2
- phpunit/phpunit: ^9.5
README
Manage http messages
Installation
Seeren\Http is a PSR-7 http messages interfaces and a PSR-18 http client interfaces implementation
composer require seeren/http
Seeren\Http\Client
Retrieve response from sending request
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
use Seeren\Http\Uri\Uri; $uri = new Uri('http', 'host');
Handle incoming request Uri
use Seeren\Http\Uri\RequestUri; $uri = new RequestUri();
Seeren\Http\Stream
Handle resource with open mode
use Seeren\Http\Stream\Stream; echo new Stream('some-url', Stream::MODE_R);
Handle input for all http methods
use Seeren\Http\Stream\RequestStream; echo new RequestStream();
Handle output
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
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
use Seeren\Http\Response\Response; use Seeren\Http\Stream\ResponseStream; $response = new Response( new ResponseStream() );
License
This project is licensed under the MIT License