amphp/http-client
Asynchronous HTTP client for PHP built on Revolt and fibers. Supports HTTP/1 & HTTP/2, concurrent requests, connection pooling, redirects, gzip/deflate, streaming bodies, TLS by default, forms, cookies, and proxies—no ext/curl dependency.
FollowRedirects, RetryRequests) enables modular middleware for cross-cutting concerns like caching, auth, or observability, reducing boilerplate.ext/curl Dependency: Eliminates runtime conflicts with curl-based libraries (e.g., Guzzle) and avoids PHP’s GIL limitations for concurrent requests.spatie/laravel-async or amphp/laravel) or a custom Swoole/ReactPHP integration layer.Amp\run() or Swoole). Risk of mixed sync/async code leading to deadlocks or performance cliffs.Request/Response objects.nghttp2 FFI Dependency: Adds binary compatibility risks (e.g., PHP extensions not pre-installed on shared hosting).xdebug integration for fibers).Illuminate\Auth) be adapted to work with mutable Request objects?HttpClient instances)?LogHttpArchive interceptor meet compliance needs (e.g., GDPR, audit logs)?RetryRequests interceptor) be configured?amphp/amp, amphp/byte-stream).spatie/laravel-async or custom Swoole/AMPHP bridge.nghttp2 (FFI): For HTTP/2 performance.amphp/http-client-cookies: For session management.amphp/http-client-cache: For caching interceptors.amphp/http-client in a new async worker (e.g., Laravel Queue job).Amp\run() to test fiber compatibility.ModifyRequest).amphp/artax compatibility layer).spatie/laravel-async).HttpClient.LogHttpArchive for debugging.RetryRequests with exponential backoff).| Component | Compatibility | Mitigation |
|---|---|---|
| Laravel Middleware | Low (mutable Request/Response) |
Rewrite as interceptors or use adapters (e.g., amphp/artax). |
| Guzzle/Psr\HttpClient | Medium (API differences) | Use amphp/artax for PSR-7 compatibility or write request/response adapters. |
| Database (Eloquent) | High (async DB drivers like amphp/pdo can work alongside) |
Ensure DB calls are async (e.g., Amp\wait() for queries). |
| Queue Workers | High (ideal for async I/O) | Use Amp\run() in job handles. |
| HTTP Proxies | High (supports amphp/http-tunnel) |
Configure via HttpClientBuilder. |
| Caching (Redis) | High (async Redis drivers like spatie/async-redis) |
No blocking calls. |
GuzzleHttp\Client in Laravel Queues with HttpClient.spatie/laravel-async to wrap HTTP-heavy routes (e.g., /search).ThirdPartyApiService).HttpClientBuilder centralizes settings (e.g., timeouts, redirects) in one place.curl Dependencies: Eliminates PHP extension conflicts.Amp\wait(), coroutine context).xdebug step-through).amphp/http-client-cache, amphp/http-tunnel) provides battle-tested extensions.How can I help you explore Laravel packages today?