A simple PSR compatible HTTP client library

v0.2.1 2022-06-04 18:24 UTC

This package is auto-updated.

Last update: 2023-05-04 20:41:37 UTC


Latest Stable Version Latest Unstable Version Build Status Total Downloads License composer.lock available

Requestful: A simple PSR compatible HTTP client library

The goal of this library is to provide a short, simple and easy to understand alternative to Guzzle.

  • Uses the latest PSR standards and recommendations
  • Supports both synchronous and asynchronous HTTP requests
  • A+ Promises with a Guzzle compatible interface
  • Modern PHP 7 support
  • Hard ext-curl requirement


composer require kwhat/requestful


You will need a PSR-17 implantation to use this library. Personally I enjoy working with nyholm/psr7, but any library that provides psr/http-factory will be sufficient.

$factory = new Nyholm\Psr7\Factory\Psr17Factory();
$client = new Requestful\Http\Client($factory);
$request = $factory->createRequest(

// Send a synchronous request
$response = $client->sendRequest($request);

    $response->getStatusCode(), // int(200)
    $response->getHeaderLine("content-type"), // string(30) "application/json; charset=utf8"
    $response->getBody() // string(459) "{"coord": {...}, "weather": {...}, ...}"

// Send an asynchronous request
$promise = $client->sendRequestAsync($request)
    ->then(function (Psr\Http\Message\ResponseInterface $response): string {
        return "Success: {$response->getStatusCode()}";

var_dump($promise->wait()); // string(12) "Success: 200"