AMPHP is a collection of event-driven libraries for PHP designed with fibers and concurrency in mind.
This package provides an adapter for Guzzle 7 to allow using amphp/http-client
as the underlying HTTP transport, providing interoperability between libraries requiring Guzzle and libraries or applications built with AMPHP.
This package can be installed as a Composer dependency.
composer require amphp/http-client-guzzle-adapter
- PHP 8.1+
Set the Guzzle handler as shown below to use AMPHP's HTTP Client as the request handler for Guzzle HTTP requests. This allows libraries relying on a Guzzle HTTP client to be used within an async application built upon AMPHP.
<?php
use Amp\Http\Client\GuzzleAdapter\GuzzleHandlerAdapter;
use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
$client = new Client([
'handler' => HandlerStack::create(new GuzzleHandlerAdapter()),
]);
More extensive code examples reside in the examples
directory.
amphp/http-client-guzzle-adapter
follows the semver semantic versioning specification like all other amphp
packages.
If you discover any security related issues, please use the private security issue reporter instead of using the public issue tracker.
The MIT License (MIT). Please see LICENSE
for more information.