A fully async, non-blocking HTTP client built using stream_socket_client
and stream_select
. No cURL. No Guzzle.
- π Non-blocking requests using PHP streams
- π Multiple async requests in parallel
- π Retries and timeout support
- π§© PSR-18 / PSR-7 compatible
- β GET, POST, PUT, PATCH, DELETE supported
composer require async-http/async-http
<?php
require_once('vendor/autoload.php');
use Async\Http\AsyncHttpClient;
$url = 'https://jsonplaceholder.typicode.com/posts';
$client = new AsyncHttpClient();
foreach ($client->get($url) as $response) {
echo $response->getBody();
}