ricardofiorani/guzzle-psr18-adapter
Tiny adapter that lets you use Guzzle as a PSR-18 HTTP client. Bridges PSR-7 requests/responses and promises to the PSR-18 ClientInterface, easing migration to standards-based HTTP without rewriting existing Guzzle integrations.
Http\Client\ClientInterface), enabling interoperability with modern PHP frameworks (e.g., Laravel, Symfony) that adopt PSR standards. This aligns well with Laravel’s evolving adoption of PSR interfaces (e.g., PSR-7, PSR-15).Illuminate\Http\Client) is PSR-18 compatible (since v9.x), but this adapter could still be valuable for:
config/app.php or via a service provider.Http\Client\ClientInterface to the adapter).Http facade to delegate to the adapter for consistency.HttpClient).HttpClient or another PSR-18 implementation suffice?php-http/guzzle7-adapter) be prioritized instead?Http::fake() could be extended to mock the adapter).spatie/laravel-ignition for error reporting).GuzzleHttp\Client) and identify replaceable instances.$this->app->bind(\Http\Client\ClientInterface::class, function ($app) {
return new \RicardoFiorani\GuzzlePsr18Adapter(new \GuzzleHttp\Client());
});
Http facade to use the adapter (optional).Http\Client\ClientInterface (e.g., sendRequest, sendAsyncRequest).Transfer::withBody()).retry(), throw()).RetryMiddleware) may not map cleanly to PSR-15. Document workarounds.ConnectException) may surface as a generic PSR-18 exception.GuzzleHttp\RingPhp issues).How can I help you explore Laravel packages today?