egeloen/http-adapter
Deprecated HTTP client abstraction for PHP 5.4.8+ that issues requests via multiple adapters (cURL, Guzzle, Buzz, Zend, etc.) and follows PSR-7 message standards. Bugfixes only; new features moved to php-http.
illuminate/http-client).httplug should be prioritized long-term.Http client (which uses Guzzle under the hood). The adapter can wrap Guzzle or other clients while maintaining PSR-7 compliance.$httpAdapter = new EventDispatcherHttpAdapter(new GuzzleAdapter());
$httpAdapter->getEventDispatcher()->addSubscriber(new LoggerSubscriber());
php-http/httplug (e.g., php-http/guzzle7-adapter) as a drop-in replacement.Http client may suffice.httplug is PSR-18 (modern HTTP client standard), whereas this package is PSR-7-focused. Future-proofing favors httplug.php-http/httplug?
httplug that block migration?Http client handle use cases (e.g., cookie management, redirects) better than this package?TrustProxies)?httplug?httplug adapters (e.g., Guzzle, cURL)?GuzzleHttp\Client in Illuminate\Http\Client\PendingRequest.$this->app->bind(IvoryHttpAdapter::class, function ($app) {
$guzzleAdapter = new GuzzleAdapter(new Client());
return new EventDispatcherHttpAdapter($guzzleAdapter);
});
| Event Subscriber | Laravel Middleware Equivalent |
|---|---|
LoggerSubscriber |
LogRequestMiddleware |
RetrySubscriber |
Custom retry middleware |
CacheSubscriber |
CacheResponseMiddleware |
Http tests can be adapted to use the adapter, with mocks for event subscribers.php-http/httplug (e.g., guzzle7-adapter).Http client usage with the adapter where event-driven features (e.g., retries) are needed.httplug plugins.httplug (e.g., Http\Adapter\Guzzle\Guzzle7Adapter).deprecated() call in the service provider.httplug is the future standard. Plan for eventual migration.EventDispatcher can coexist with Laravel’s events, but custom glue code may be needed for cross-system events.httplug
httplug adapters (e.g., Guzzle, cURL).httplug.composer.json can enforce version constraints.httplug.tap() method to inspect requests/responses.CacheSubscriber) requires distributed cache (Redis).| Failure Scenario | Mitigation Strategy |
|---|---|
| Adapter-specific bugs | Use try-catch with HttpAdapterException and fall back to a secondary adapter. |
| Event subscriber deadlocks | Avoid blocking operations in subscribers (e.g., sync DB writes). |
| Async adapter crashes | Implement circuit breakers (e.g., php-http/retry-plugin). |
| Deprecated package EOL | Set a hard deadline for migration to httplug. |
| Laravel version incompatibilities | Test against Laravel’s LTS versions (e.g., 8.x, 9.x, 10.x). |
How can I help you explore Laravel packages today?