Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Http Client

Http Client Laravel Package

amphp/http-client

A fully asynchronous HTTP/1 and HTTP/2 client for PHP built on Revolt, with no cURL dependency. It supports concurrent requests, connection pooling, redirects, compression, streaming bodies, cookies, and proxies through a composable interceptor API.

View on GitHub
Deep Wiki
Context7

An advanced async HTTP client library for PHP, enabling efficient, non-blocking, and concurrent requests and responses.

Frequently asked questions about Http Client
How do I install amphp/http-client in a Laravel project?
Install it with composer require amphp/http-client. It is framework-agnostic and installs alongside Guzzle without curl coupling, so existing Laravel HTTP client code keeps working. Register it behind a dedicated service provider or singleton only where you need concurrent fan-out.
Can amphp/http-client replace Laravel's Http facade or Guzzle?
No, it is not a drop-in replacement. Laravel's Http facade, testing helpers, and most ecosystem packages assume synchronous, blocking Guzzle and PSR semantics. Use amphp/http-client as a bounded, opt-in adapter for latency-bound fan-out while leaving existing Http facade calls untouched.
Does amphp/http-client require ext/curl?
No. The library manually implements HTTP/1.1 and HTTP/2 over TCP sockets and has no ext/curl dependency. You can optionally install nghttp2 and use FFI to speed up HTTP/2 and reduce memory usage.
Can I use amphp/http-client with Laravel Octane and Swoole?
Treat that combination as unsupported without a dedicated spike. Running Revolt's event loop inside Swoole introduces two competing async runtimes in the same process. A per-request event loop on FPM or CLI is the straightforward deployment target.
Why do my concurrent amphp/http-client requests stall inside Laravel?
The usual cause is event-loop starvation: any blocking call inside a fiber, such as PDO, file_get_contents, sleep, synchronous logging, or Guzzle, stalls every other in-flight request in that process. This is an architectural discipline issue rather than a library bug. Keep blocking work outside the fiber or move it to a separate process.
Does amphp/http-client support cookies and proxies out of the box?
The core package does not include a cookie jar or proxy tunnel. Cookies live in amphp/http-client-cookies and proxy support in amphp/http-tunnel, so plan those dependencies explicitly. Add integration tests because defaults may differ from Guzzle.
Is amphp/http-client PSR-18 or PSR-7 compatible?
Not out of the box. Its Request and Response classes are deliberately mutable and are not PSR-7, and no PSR-18 client is provided directly. If you need interoperability, validate any bridge or hand-written adapter against the exact major version you install.
How does amphp/http-client handle redirects compared with Guzzle?
Its redirect policy is opinionated: only GET requests are automatically followed, and cross-origin redirects drop all headers. That is reasonable for security but differs from Guzzle and can surface as behavioural regressions. Test redirect-heavy call paths explicitly before migrating any logic.
How do I stream large responses without leaking connections in amphp/http-client?
Response bodies are Payload objects that must be buffered or streamed and then closed. For large transfers, use streaming so memory stays bounded, and close the body in a finally block. Unclosed bodies can leak connections even with pooling enabled.
How should I test Laravel code that uses amphp/http-client?
Laravel's Http fake does not cover this client because it is not wired into the Guzzle-backed facade. Hide it behind a first-party interface such as a batch HTTP client contract and fake that adapter in unit tests. Use a local test server or composable interceptors for integration tests covering redirects, cookies, proxies, and streaming.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin
artisan-build/community-prompts
vleroy/smart
ayles-software/laravel-australian-public-holidays
cboxdk/laravel-id-spatie
cboxdk/laravel-id-billing
cboxdk/laravel-id-billing-bridge
simple-as-fuck/php-performance-log
hsluv/hsluv
seampact/codegen
seampact/hooks
seampact/ir
mehedimi/laravel-amp-mail
happones/laravel-vue-i18n-generator
jwerd/inertia-table
siberfx/flysystem-wasabi
hollyit/token-replace
ippanelcom/laravel-sdk