react/http-client
Deprecated ReactPHP streaming, event-driven HTTP client kept for BC. Development moved to react/http with a new Promise-based, PSR-7 Browser API. Upgrade recommended; see react/http for current client usage and features.
This package is deprecated as of 2021-04-07 and has been fully migrated into react/http. Do not start new projects with react/http-client—migrate immediately if you're still using it. The modern replacement uses PSR-7/18-compatible Browser instances and Promises for cleaner async code.
If you inherited legacy code using React\HttpClient\Client, the migration path is straightforward:
react/http-client with react/httpReact\HttpClient\* to React\Http\*Client/Request event-streaming pattern with Browser methods returning Promises (see below)Example upgrade:
composer remove react/http-client && composer require react/http
Then refactor old streaming code:
// ❌ OLD (deprecated)
$client = new React\HttpClient\Client($loop);
$request = $client->request('GET', $url);
$request->on('response', fn($res) => $res->on('data', fn($chunk) => echo $chunk));
// ✅ NEW (recommended)
$browser = new React\Http\Browser($loop);
$browser->get($url)->then(fn($res) => echo $res->getBody());
Legacy usage (still seen in older codebases):
Client with EventLoopInterface + optional ConnectorInterfacerequest($method, $uri, $headers) → write() → end()response, data, end, error, close)Modern equivalents in react/http:
React\Http\Browser for all HTTP operations (GET/POST/etc. as named methods)React\Promise\PromiseInterface resolving to Psr\Http\Message\ResponseInterface->otherwise() or try/catch with async-aware error handlinggetBody() or pipe() for large responsesTypical workflows:
$browser->get('https://api.example.com/')->then(...)$browser->post($url, ['Content-Type' => 'application/json'], json_encode($data))React\Http\Browser::all([$browser->get($a), $browser->get($b)])$browser->withOptions(['timeout' => 5.0])->get(...)Unix domain sockets (still relevant):
Connector with FixedUriConnector pointing to unix:///path/to.sockhttp://localhost/ as target URI (host ignored, UDS path used instead)react/http. Upgrade ASAP.['verify_peer' => false]).Client had known leaks with long-lived connections or large files. The new Browser handles buffering more efficiently.http-client release (0.5.11) includes minor fixes for PHP 8, but react/http is the only supported version for modern PHP.react/socket’s Connector to configure HTTP/SOCKS proxies—this was easier to misconfigure in older versions.Client’s connector to a custom logger. In the new API, use $browser->withOptions(['debug' => true]).React\HttpClient\Client → React\Http\Browser, but always refactor request logic manually—don’t rely on mechanical replacements.httpbin.org. For offline work, run phpunit --exclude-group internet.How can I help you explore Laravel packages today?