Skip to content
This repository has been archived by the owner on Jul 18, 2023. It is now read-only.
/ http-client Public archive

(unmaintained) Minimalist PSR-18 HTTP Client

Notifications You must be signed in to change notification settings

kodus/http-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kodus/http-client

Minimalist PSR-18 HTTP Client.

PHP Version Build Status Code Coverage

  • 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.

About

(unmaintained) Minimalist PSR-18 HTTP Client

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages