diff --git a/clients/guzzle6-adapter.rst b/clients/guzzle6-adapter.rst index 581f54a..ac18be5 100644 --- a/clients/guzzle6-adapter.rst +++ b/clients/guzzle6-adapter.rst @@ -16,21 +16,32 @@ not yet included in your project), run: Usage ----- -Begin by creating a Guzzle client, passing any configuration parameters you -like:: +To create a Guzzle6 adapter you should use the `createWithConfig()` function. It will let you to pass Guzzle configuration +to the client:: - use GuzzleHttp\Client as GuzzleClient; + use Http\Adapter\Guzzle6\Client as GuzzleAdapter; $config = [ - // Config params + 'verify' => false, + 'timeout' => 2, + 'handler' => //... + // ... ]; - $guzzle = new GuzzleClient($config); + $adapter = GuzzleAdapter::createWithConfig($config); -Then create the adapter:: +.. note:: - use Http\Adapter\Guzzle6\Client as GuzzleAdapter; + If you want even more control over your Guzzle object, you may give a Guzzle client as first argument to the adapter's + constructor:: - $adapter = new GuzzleAdapter($guzzle); + use GuzzleHttp\Client as GuzzleClient; + use Http\Adapter\Guzzle6\Client as GuzzleAdapter; + + $config = ['verify' => false ]; + // ... + $guzzle = new GuzzleClient($config); + // ... + $adapter = new GuzzleAdapter($guzzle); And use it to send synchronous requests:: @@ -50,6 +61,7 @@ Or send asynchronous ones:: // Returns a Http\Promise\Promise $promise = $adapter->sendAsyncRequest(request); + .. include:: includes/further-reading-async.inc .. _Guzzle 6 HTTP client: http://docs.guzzlephp.org/