kodus / http-client
This package is abandoned and no longer maintained.
No replacement package was suggested.
Minimalist PSR-18 HTTP Client
1.0.0
2019-07-04 10:02 UTC
Requires
- php: >7.1
- ext-json: *
- psr/http-client: ^1.0
Requires (Dev)
- mindplay/testies: ^1
- nyholm/psr7: ^1.1
- phpunit/php-code-coverage: >=6, <8
This package is auto-updated.
Last update: 2023-02-01 08:45:46 UTC
README
Minimalist PSR-18 HTTP Client.
- No dependencies beyond PSR-17 HTTP Factory implementations
- Streaming response: suitable for fetching large responses.
- Accepts and decodes
gzip
encoded response content.
Note that this client does not follow redirects: PSR-18 doesn't specify - but this is a client, not a browser, and it's designed to be bootstrapped as a service instance: some dependents may need to know the status-code of the actual response; automatically following redirects makes that impossible.
Usage
Basic example using nyholm/psr7
:
use Kodus\Http\HttpClient; use Nyholm\Psr7\Factory\Psr17Factory; // Bootstrap the client: $http = new Psr17Factory(); $client = new HttpClient($http, $http); // Perform a request: $response = $client->sendRequest( $http->createRequest("GET", "https://postman-echo.com/get?foo=bar") );
Please refer to PSR-18 documentation for details.