amphp / http-client-guzzle-adapter
Guzzle adapter for Amp's HTTP client.
Fund package maintenance!
amphp
Installs: 1 730
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=8.1
- amphp/amp: ^3
- amphp/byte-stream: ^2.1
- amphp/dns: ^2.2
- amphp/http-client: ^5
- amphp/http-client-psr7: ^1
- amphp/socket: ^2.3
- guzzlehttp/guzzle: ^7
- guzzlehttp/promises: ^1 || ^2
- guzzlehttp/psr7: ^1 || ^2
- psr/http-factory-implementation: ^1
- psr/http-message: ^1.1 || ^2
- revolt/event-loop: ^1
Requires (Dev)
- amphp/file: ^3.0
- amphp/http-tunnel: ^2
- amphp/php-cs-fixer-config: ^2
- amphp/phpunit-util: ^3
- phpunit/phpunit: ^9
- psalm/phar: ^5
README
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.
Installation
This package can be installed as a Composer dependency.
composer require amphp/http-client-guzzle-adapter
Requirements
- PHP 8.1+
Usage
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()), ]);
Examples
More extensive code examples reside in the examples
directory.
Versioning
amphp/http-client-guzzle-adapter
follows the semver semantic versioning specification like all other amphp
packages.
Security
If you discover any security related issues, please use the private security issue reporter instead of using the public issue tracker.
License
The MIT License (MIT). Please see LICENSE
for more information.