It's just a simple wrapper/helper around reactphp/http
library. which creates a better Developer Experience and
faster development..
// 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
});
This way response body automatically decoded
$api->setResponseHandler(\Saraf\ResponseHandlers\HandlerEnum::Json);