File tree Expand file tree Collapse file tree 3 files changed +68
-0
lines changed Expand file tree Collapse file tree 3 files changed +68
-0
lines changed Original file line number Diff line number Diff line change 1
1
Guzzle5 Adapter
2
2
===============
3
+
4
+ An HTTPlug adapter for the `Guzzle 5 HTTP client `_.
5
+
6
+ To install the Guzzle adapter, which will also install Guzzle itself (if it was
7
+ not yet included in your project), run:
8
+
9
+ .. code-block :: bash
10
+
11
+ $ composer require php-http/guzzle5-adapter
12
+
13
+ .. include :: includes/install-message-factory.inc
14
+
15
+ .. include :: includes/install-discovery.inc
16
+
17
+ Then begin by creating a Guzzle client, passing any configuration parameters you
18
+ like::
19
+
20
+ use GuzzleHttp\Client as GuzzleClient;
21
+
22
+ $config = [
23
+ // Config params
24
+ ];
25
+ $guzzle = new GuzzleClientClient($config);
26
+
27
+ Then create the adapter::
28
+
29
+ use Http\Adapter\Guzzle5\Client as GuzzleAdapter;
30
+ use Http\Message\MessageFactory\GuzzleMessageFactory;
31
+
32
+ $adapter = new GuzzleAdapter($guzzle, new GuzzleMessageFactory());
33
+
34
+ Or if you installed the :ref: `discovery <discovery >` layer::
35
+
36
+ use Http\Adapter\Guzzle5\Client as GuzzleAdapter;
37
+
38
+ $adapter = new GuzzleAdapter($guzzle);
39
+
40
+ .. warning ::
41
+
42
+ The message factory parameter is mandatory if the discovery layer is not installed.
43
+
44
+ .. include :: includes/further-reading-sync.inc
45
+
46
+ .. _Guzzle 5 HTTP client : http://docs.guzzlephp.org/en/5.3/
Original file line number Diff line number Diff line change
1
+ Alternatively you can install the :ref:`discovery <discovery>` layer
2
+ to be able to automatically find installed resources, like factories:
3
+
4
+ .. code-block:: bash
5
+
6
+ $ composer require php-http/discovery
Original file line number Diff line number Diff line change
1
+ This client does not come with a PSR-7 implementation out of the box, so you have
2
+ to install one as well (for example `Guzzle PSR-7`_):
3
+
4
+ .. code-block:: bash
5
+
6
+ $ composer require guzzlehttp/psr7
7
+
8
+ In order to provide full interoperability, message implementations are
9
+ accessed through :ref:`factories <message-factory>`. Message factories for
10
+ `Diactoros`_ are `Guzzle PSR-7`_ implementations are available in the
11
+ :ref:`message <message>` component:
12
+
13
+ .. code-block:: bash
14
+
15
+ $ composer require php-http/message
16
+
17
+ .. _Diactoros: http://docs.guzzlephp.org/en/5.3/
18
+ .. _Guzzle PSR-7: https://github.com/guzzle/psr7
You can’t perform that action at this time.
0 commit comments