alextartan/guzzle-psr18-adapter
PSR-18 HTTP client adapter for Guzzle. Wraps Guzzle to provide a PSR-18 ClientInterface, letting you send PSR-7 requests and receive PSR-7 responses with standard client/network/request exceptions. Requires PHP 7.2+.
fruitcake/laravel-psr15) or integrating with frameworks like Symfony.psr/http-message).ClientInterface in unit tests.psr/http-factory), this adapter provides a drop-in PSR-18 client with minimal refactoring.Client, preserving existing functionality.ClientInterface in Laravel’s container.sendAsync) may need adjustments for Laravel’s sync queue workers.php-http/guzzle8-adapter: Actively maintained, supports Guzzle 8.guzzlehttp/guzzle, psr/http-message) already align with PSR-18?php-http/guzzle8-adapter.Illuminate\Http\Client)?sendRequest?pestphp/pest, phpunit)?ClientInterface to Psr18Adapter for dependency injection:
$this->app->bind(\Psr\Http\Client\ClientInterface::class, function ($app) {
return new \Alextartan\GuzzlePsr18Adapter\Psr18Adapter(
new \GuzzleHttp\Client()
);
});
Http facade or Illuminate\Http\Client.fruitcake/laravel-psr15).GuzzleHttp\Client instantiations.requestAsync, get()).GuzzleHttp\Client with Psr18Adapter in service providers or facades.Psr\Http\Client\ClientInterface.php-http/message).GuzzleHttp\Middleware with Psr15Middleware.php-http/client-tests.| Guzzle Version | Adapter Support | Laravel Compatibility | Notes |
|---|---|---|---|
| 6.x | ✅ | ✅ (Laravel 8/9) | Tested |
| 7.x | ❌ | ❌ (Laravel 10+) | May require polyfills |
| 8.x | ❌ | ❌ | Unlikely; use guzzle8-adapter |
Psr\Http\Message\RequestInterface is used consistently.GET to a public API).App\Services\ApiService).GuzzleHttp\Client.sendRequest (sync) or sendAsync (if supported).php-http/guzzle8-adapter if Guzzle 7/8 is adopted.How can I help you explore Laravel packages today?