Skip to content

Commit 1a6d40e

Browse files
sagikazarmarkshulard
authored andcommitted
Merge pull request php-http#84 from php-http/guzzle5
Add Guzzle 5 documentation
2 parents 693282a + dac936b commit 1a6d40e

File tree

5 files changed

+83
-1
lines changed

5 files changed

+83
-1
lines changed

clients/guzzle5-adapter.rst

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,52 @@
11
Guzzle5 Adapter
22
===============
3+
4+
An HTTPlug adapter for the `Guzzle 5 HTTP client`_.
5+
6+
Installation
7+
------------
8+
9+
To install the Guzzle adapter, which will also install Guzzle itself (if it was
10+
not yet included in your project), run:
11+
12+
.. code-block:: bash
13+
14+
$ composer require php-http/guzzle5-adapter
15+
16+
.. include:: includes/install-message-factory.inc
17+
18+
.. include:: includes/install-discovery.inc
19+
20+
Usage
21+
-----
22+
23+
Begin by creating a Guzzle client, passing any configuration parameters you
24+
like::
25+
26+
use GuzzleHttp\Client as GuzzleClient;
27+
28+
$config = [
29+
// Config params
30+
];
31+
$guzzle = new GuzzleClientClient($config);
32+
33+
Then create the adapter::
34+
35+
use Http\Adapter\Guzzle5\Client as GuzzleAdapter;
36+
use Http\Message\MessageFactory\GuzzleMessageFactory;
37+
38+
$adapter = new GuzzleAdapter($guzzle, new GuzzleMessageFactory());
39+
40+
Or if you installed the :doc:`discovery </discovery>` layer::
41+
42+
use Http\Adapter\Guzzle5\Client as GuzzleAdapter;
43+
44+
$adapter = new GuzzleAdapter($guzzle);
45+
46+
.. warning::
47+
48+
The message factory parameter is mandatory if the discovery layer is not installed.
49+
50+
.. include:: includes/further-reading-sync.inc
51+
52+
.. _Guzzle 5 HTTP client: http://docs.guzzlephp.org/en/5.3/

clients/guzzle6-adapter.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,20 @@ Guzzle 6 Adapter
33

44
An HTTPlug adapter for the `Guzzle 6 HTTP client`_.
55

6+
Installation
7+
------------
8+
69
To install the Guzzle adapter, which will also install Guzzle itself (if it was
710
not yet included in your project), run:
811

912
.. code-block:: bash
1013
1114
$ composer require php-http/guzzle6-adapter
1215
13-
Then begin by creating a Guzzle client, passing any configuration parameters you
16+
Usage
17+
-----
18+
19+
Begin by creating a Guzzle client, passing any configuration parameters you
1420
like::
1521

1622
use GuzzleHttp\Client as GuzzleClient;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Alternatively you can install the :doc:`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
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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 :doc:`factories </message/message-factory>`. Message factories for
10+
`Diactoros`_ and `Guzzle PSR-7`_ are available in the
11+
:doc:`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

clients/socket-client.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ To install the Socket client, run:
2121
2222
$ composer require php-http/socket-client
2323
24+
.. include:: includes/install-message-factory.inc
25+
2426
Usage
2527
-----
2628

0 commit comments

Comments
 (0)