saraf / async-request
a wrapper around reactphp/http
Installs: 2 612
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Requires
- php: >=8.1
- react/async: ^4 || ^3 || ^2
- react/http: >=1.6
- react/promise: >=2.10.0
This package is auto-updated.
Last update: 2024-12-24 15:40:30 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);