saraf/async-request
a wrapper around reactphp/http
Maintainers
0.0.1
2023-11-26 09:55 UTC
Requires
- php: >=8.1
- react/async: ^4 || ^3 || ^2
- react/http: >=1.6
- react/promise: >=2.10.0
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
MIT 4274da0cabdd8323a3d30b91b1ea3d5368bceabc
- Hasan Parasteh <hasanparasteh.woop@gmail.com>
This package is auto-updated.
Last update: 2026-06-18 12:07:44 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);
