@@ -16,21 +16,32 @@ not yet included in your project), run:
16
16
Usage
17
17
-----
18
18
19
- Begin by creating a Guzzle client, passing any configuration parameters you
20
- like ::
19
+ To create a Guzzle6 adapter you should use the ` createWithConfig() ` function. It will let you to pass Guzzle configuration
20
+ to the client ::
21
21
22
- use GuzzleHttp\ Client as GuzzleClient ;
22
+ use Http\Adapter\Guzzle6\ Client as GuzzleAdapter ;
23
23
24
24
$config = [
25
- // Config params
25
+ 'verify' => false,
26
+ 'timeout' => 2,
27
+ 'handler' => //...
28
+ // ...
26
29
];
27
- $guzzle = new GuzzleClient ($config);
30
+ $adapter = GuzzleAdapter::createWithConfig ($config);
28
31
29
- Then create the adapter ::
32
+ .. note ::
30
33
31
- use Http\Adapter\Guzzle6\Client as GuzzleAdapter;
34
+ If you want even more control over your Guzzle object, you may give a Guzzle client as first argument to the adapter's
35
+ constructor::
32
36
33
- $adapter = new GuzzleAdapter($guzzle);
37
+ use GuzzleHttp\Client as GuzzleClient;
38
+ use Http\Adapter\Guzzle6\Client as GuzzleAdapter;
39
+
40
+ $config = ['verify' => false ];
41
+ // ...
42
+ $guzzle = new GuzzleClient($config);
43
+ // ...
44
+ $adapter = new GuzzleAdapter($guzzle);
34
45
35
46
And use it to send synchronous requests::
36
47
@@ -50,6 +61,7 @@ Or send asynchronous ones::
50
61
// Returns a Http\Promise\Promise
51
62
$promise = $adapter->sendAsyncRequest(request);
52
63
64
+
53
65
.. include :: includes/further-reading-async.inc
54
66
55
67
.. _Guzzle 6 HTTP client : http://docs.guzzlephp.org/
0 commit comments