Guzzle 7 Adapter
HTTPlug and PSR-18 adapter that wraps the Guzzle 7 HTTP client behind standard interfaces.
Repository Health
Technical Analysis
Guzzle 7 Adapter is part of the PHP-HTTP (HTTPlug) project and lets you use the Guzzle 7 HTTP client through the standard HTTPlug and PSR-18 client interfaces. It wraps a Guzzle client in an adapter that implements both the synchronous HttpClient and asynchronous HttpAsyncClient contracts.
By programming against these vendor-neutral interfaces, libraries can accept any HTTP client implementation and let the application choose Guzzle 7 at composition time, avoiding a hard dependency on a specific client. The package advertises php-http/client-implementation, async-client-implementation, and psr/http-client-implementation via Composer’s provide mechanism.
What You Get
- A Client implementing both HTTPlug HttpClient and HttpAsyncClient interfaces
- PSR-18 compatibility for interoperable HTTP client usage
- Synchronous sendRequest and asynchronous sendAsyncRequest returning HTTPlug promises
- A createWithConfig factory to build the adapter with custom Guzzle configuration
- Composer virtual packages so it satisfies client-implementation requirements
Common Use Cases
- Providing a concrete HTTP client to libraries that depend only on HTTPlug or PSR-18
- Decoupling application code from a specific HTTP client implementation
- Using Guzzle 7 asynchronously through the HTTPlug promise interface
- Satisfying a package’s php-http/client-implementation virtual dependency with Guzzle 7
Under The Hood
Architecture - The package is small and focused: a final Client class (src/Client.php) implements HTTPlug’s HttpClient and HttpAsyncClient. It wraps a GuzzleHttp\ClientInterface, delegating sendAsyncRequest to Guzzle’s sendAsync and wrapping the returned Guzzle promise in a local Promise class (src/Promise.php) that conforms to the HTTPlug promise contract; sendRequest simply awaits that promise via wait(). A buildClient factory assembles a default Guzzle client with an HTTP-error middleware, and createWithConfig allows custom Guzzle configuration.
Tech Stack - PHP 7.3+/8.0+ built on guzzlehttp/guzzle ^7.10, php-http/httplug ^2.4, and psr/http-client, using strict_types and the #[\Override] attribute. It advertises the client-implementation, async-client-implementation, and psr/http-client-implementation virtual packages through Composer’s provide section.
Code Quality - Quality tooling is thorough for its size: PHPStan and Psalm configurations (with baselines) enforce static analysis, and the test suite runs the shared php-http/client-integration-tests against multiple handler configurations (curl, multi-curl, stream) plus dedicated Promise and exception tests. The code uses declare(strict_types=1) throughout.
API Design - The surface is deliberately minimal: new Client($guzzle) or Client::createWithConfig([…]), then the standard sendRequest / sendAsyncRequest methods. Because consumers depend on the HTTPlug/PSR-18 interfaces rather than this class directly, integration is essentially zero-boilerplate, and the official php-http documentation covers configuration.
Used by 2 apps in this directory
Leantime
Productivity · Project Management · Collaboration
Project management built for ADHD, autism, and dyslexia — simple as Trello, powerful as Jira
Mautic
Automation · Marketing · Ecommerce
The world's largest open source marketing automation platform — own your data, run multi-channel campaigns, and escape vendor lock-in forever.