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
Psr 18 Guzzle Adapter

Psr 18 Guzzle Adapter Laravel Package

jord-jd/psr-18-guzzle-adapter

A simple PSR-18 adapter for Guzzle, supporting PHP 7.1+ with Guzzle 6 or 7. It keeps Guzzle 6 projects compatible with PSR-18 clients and normalizes Guzzle exceptions to the PSR-18 exception interfaces.

View on GitHub
Deep Wiki
Context7

PSR-18 adapter for the Guzzle HTTP client

Frequently asked questions about Psr 18 Guzzle Adapter
What is jord-jd/psr-18-guzzle-adapter used for?
It wraps a Guzzle HTTP client so your code can depend on Psr\Http\Client\ClientInterface instead of GuzzleHttp\Client. It is most useful when a package or internal consumer requires PSR-18, or when you need to keep PHP 7.1 and Guzzle 6 compatibility while moving toward PSR-18 interfaces.
Do I still need this adapter if I use Guzzle 7?
Usually no. Guzzle 7 implements PSR-18 directly, so on PHP 7.2.5 or newer you can normally bind GuzzleHttp\Client as your Psr\Http\Client\ClientInterface implementation. This adapter is mainly for PHP 7.1 and Guzzle 6 projects, or projects that specifically want its Guzzle 6 exception normalization.
How do I install and configure it in a Laravel app?
Install it with composer require jord-jd/psr-18-guzzle-adapter, then bind a configured adapter instance to Psr\Http\Client\ClientInterface in a Laravel service provider. Assume manual wiring: the README does not evidence auto-discovery or a Psr18GuzzleAdapterServiceProvider, so verify class names against the source before relying on them. You will also need a PSR-17 request factory such as guzzlehttp/psr7 or nyholm/psr7.
Does it support PHP 7.1 and Guzzle 6?
Yes. The package supports PHP 7.1 through current releases and works with Guzzle 6 or Guzzle 7. It keeps Guzzle 6 projects compatible with PSR-18 clients and normalizes Guzzle 6 exceptions to the PSR-18 exception interfaces. Confirm your exact PHP and Guzzle versions in CI because the release metadata should not be treated as fully verified.
How does it handle non-2xx responses and HTTP errors?
The package is intended to normalize Guzzle exceptions to PSR-18 exception interfaces, especially for Guzzle 6. However, Guzzle defaults to http_errors set to true and throws its own exception hierarchy, so confirm the adapter forces http_errors to false and maps connection, timeout, and request failures correctly. Validate this with tests rather than trusting the README alone.
Is this adapter PSR-18 compliant?
Treat PSR-18 conformance as something to verify, not assume. A practical checklist is: non-2xx responses are returned rather than thrown, connection and timeout errors surface as NetworkExceptionInterface, malformed or refused requests map to RequestExceptionInterface, and request bodies are rewound on retry or redirect. Run those checks against the exact version you plan to install.
Do I need a PSR-17 factory as well?
Yes. PSR-18 only defines sendRequest, so you still need a PSR-17 factory to construct requests. Common choices are guzzlehttp/psr7 or nyholm/psr7. You also need to decide where Guzzle middleware and client configuration live, because the adapter is only the PSR-18 seam.
What are the alternatives to this package?
Common alternatives are php-http/guzzle7-adapter, which is MIT licensed and maintained by the php-http organization, or writing a small in-house adapter if you only need to wrap one Guzzle client. If you are on Guzzle 7, you can often use GuzzleHttp\Client directly as your PSR-18 implementation. There is no strong differentiator that justifies adding a single-maintainer dependency unless you specifically need Guzzle 6 compatibility.
Can I use it alongside Laravel's HTTP client?
You can, but avoid running two HTTP surfaces by accident. Laravel's Illuminate\Support\Facades\Http client is Guzzle-backed but is not itself PSR-18, so layering this adapter alongside it can create divergent retry, timeout, logging, and metrics behavior. Pick one primary HTTP surface and use the adapter only where a consumer actually requires PSR-18.
What license does it use, and is it safe for commercial Laravel apps?
The package is LGPL-3.0 licensed, which is atypical in the PHP ecosystem and usually requires legal sign-off. It is likely fine for unmodified Composer use in a commercial Laravel application, but forking and redistribution need review. Also consider the maintenance risk: it has a single maintainer, few stars and dependents, and no documented security policy or CI badges.
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.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource