saraf/async-request

a wrapper around reactphp/http

Installs: 4 375

Dependents: 1

Suggesters: 0

Security: 0

Stars: 1

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/saraf/async-request

0.0.1 2023-11-26 09:55 UTC

This package is auto-updated.

Last update: 2025-10-18 10:42:38 UTC


README

It's just a simple wrapper/helper around reactphp/http library. which creates a better Developer Experience and faster development..

Easy Setup

// initialize basic class
$api = new \Saraf\AsyncRequestJson()
$api->setConfig([
    "baseURL" => "https://jsonplaceholder.typicode.com"
]);

// It will return Promise
$api->post("/todos", [
    'title' => 'learn async-request lib',
    'isDone' => false
])->then(function ($response) {
    // $response contains result, status code, headers and body of that request      
});

Customize Response Handler

This way response body automatically decoded

$api->setResponseHandler(\Saraf\ResponseHandlers\HandlerEnum::Json);