An HTTPlug adapter for the Guzzle 5 HTTP client.
To install the Guzzle adapter, which will also install Guzzle itself (if it was not yet included in your project), run:
$ composer require php-http/guzzle5-adapter
Begin by creating a Guzzle client, passing any configuration parameters you like:
use GuzzleHttp\Client as GuzzleClient; $config = [ // Config params ]; $guzzle = new GuzzleClient($config);
Then create the adapter:
use Http\Adapter\Guzzle5\Client as GuzzleAdapter; use Http\Message\MessageFactory\GuzzleMessageFactory; $adapter = new GuzzleAdapter($guzzle, new GuzzleMessageFactory());
Or if you installed the :doc:`discovery </discovery>` layer:
use Http\Adapter\Guzzle5\Client as GuzzleAdapter; $adapter = new GuzzleAdapter($guzzle);
The message factory parameter is mandatory if the discovery layer is not installed.