From 89fbbc2876d67715efc5e1f286cf43a3d14e7b47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rk=20S=C3=A1gi-Kaz=C3=A1r?= Date: Wed, 27 Jan 2016 14:29:15 +0100 Subject: [PATCH 1/4] Add guzzle 5 documentation --- clients/guzzle5-adapter.rst | 44 ++++++++++++++++++++ clients/includes/install-discovery.inc | 6 +++ clients/includes/install-message-factory.inc | 18 ++++++++ 3 files changed, 68 insertions(+) create mode 100644 clients/includes/install-discovery.inc create mode 100644 clients/includes/install-message-factory.inc diff --git a/clients/guzzle5-adapter.rst b/clients/guzzle5-adapter.rst index bbdac9c..bac6189 100644 --- a/clients/guzzle5-adapter.rst +++ b/clients/guzzle5-adapter.rst @@ -1,2 +1,46 @@ Guzzle5 Adapter =============== + +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: + +.. code-block:: bash + + $ composer require php-http/guzzle5-adapter + +.. include:: includes/install-message-factory.inc + +.. include:: includes/install-discovery.inc + +Then begin by creating a Guzzle client, passing any configuration parameters you +like:: + + use GuzzleHttp\Client as GuzzleClient; + + $config = [ + // Config params + ]; + $guzzle = new GuzzleClientClient($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 :ref:`discovery ` layer:: + + use Http\Adapter\Guzzle5\Client as GuzzleAdapter; + + $adapter = new GuzzleAdapter($guzzle); + +.. warning:: + + The message factory parameter is mandatory if the discovery layer is not installed. + +.. include:: includes/further-reading-sync.inc + +.. _Guzzle 5 HTTP client: http://docs.guzzlephp.org/en/5.3/ diff --git a/clients/includes/install-discovery.inc b/clients/includes/install-discovery.inc new file mode 100644 index 0000000..08ece21 --- /dev/null +++ b/clients/includes/install-discovery.inc @@ -0,0 +1,6 @@ +Alternatively you can install the :ref:`discovery ` layer +to be able to automatically find installed resources, like factories: + +.. code-block:: bash + + $ composer require php-http/discovery diff --git a/clients/includes/install-message-factory.inc b/clients/includes/install-message-factory.inc new file mode 100644 index 0000000..13de8c7 --- /dev/null +++ b/clients/includes/install-message-factory.inc @@ -0,0 +1,18 @@ +This client does not come with a PSR-7 implementation out of the box, so you have +to install one as well (for example `Guzzle PSR-7`_): + +.. code-block:: bash + +$ composer require guzzlehttp/psr7 + +In order to provide full interoperability, message implementations are +accessed through :ref:`factories `. Message factories for +`Diactoros`_ are `Guzzle PSR-7`_ implementations are available in the +:ref:`message ` component: + +.. code-block:: bash + +$ composer require php-http/message + +.. _Diactoros: http://docs.guzzlephp.org/en/5.3/ +.. _Guzzle PSR-7: https://github.com/guzzle/psr7 From fd6ace02d4ccc50baa5e7046e6982bc6f41e91bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rk=20S=C3=A1gi-Kaz=C3=A1r?= Date: Wed, 27 Jan 2016 14:35:37 +0100 Subject: [PATCH 2/4] Add headings to guzzle docs --- clients/guzzle5-adapter.rst | 8 +++++++- clients/guzzle6-adapter.rst | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/clients/guzzle5-adapter.rst b/clients/guzzle5-adapter.rst index bac6189..c5ab3e1 100644 --- a/clients/guzzle5-adapter.rst +++ b/clients/guzzle5-adapter.rst @@ -3,6 +3,9 @@ Guzzle5 Adapter An HTTPlug adapter for the `Guzzle 5 HTTP client`_. +Installation +------------ + To install the Guzzle adapter, which will also install Guzzle itself (if it was not yet included in your project), run: @@ -14,7 +17,10 @@ not yet included in your project), run: .. include:: includes/install-discovery.inc -Then begin by creating a Guzzle client, passing any configuration parameters you +Usage +----- + +Begin by creating a Guzzle client, passing any configuration parameters you like:: use GuzzleHttp\Client as GuzzleClient; diff --git a/clients/guzzle6-adapter.rst b/clients/guzzle6-adapter.rst index 55f4b27..3d510e0 100644 --- a/clients/guzzle6-adapter.rst +++ b/clients/guzzle6-adapter.rst @@ -3,6 +3,9 @@ Guzzle 6 Adapter An HTTPlug adapter for the `Guzzle 6 HTTP client`_. +Installation +------------ + To install the Guzzle adapter, which will also install Guzzle itself (if it was not yet included in your project), run: @@ -10,7 +13,10 @@ not yet included in your project), run: $ composer require php-http/guzzle6-adapter -Then begin by creating a Guzzle client, passing any configuration parameters you +Usage +----- + +Begin by creating a Guzzle client, passing any configuration parameters you like:: use GuzzleHttp\Client as GuzzleClient; From 89125262a0eeeb62e8f6baffd75a3723a5b8ca8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rk=20S=C3=A1gi-Kaz=C3=A1r?= Date: Wed, 27 Jan 2016 14:39:08 +0100 Subject: [PATCH 3/4] Add message factory installation to socket client docs --- clients/socket-client.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/clients/socket-client.rst b/clients/socket-client.rst index b1a2875..66e5895 100644 --- a/clients/socket-client.rst +++ b/clients/socket-client.rst @@ -21,6 +21,8 @@ To install the Socket client, run: $ composer require php-http/socket-client +.. include:: includes/install-message-factory.inc + Usage ----- From 06360041a614576c210b8e48ff9bdc0fbe9598d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rk=20S=C3=A1gi-Kaz=C3=A1r?= Date: Wed, 27 Jan 2016 16:32:12 +0100 Subject: [PATCH 4/4] reST fixes Fix indentation Fix cross-linking Fix cross-linking Fix cross-linking --- clients/guzzle5-adapter.rst | 2 +- clients/includes/install-discovery.inc | 2 +- clients/includes/install-message-factory.inc | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/clients/guzzle5-adapter.rst b/clients/guzzle5-adapter.rst index c5ab3e1..4b441c3 100644 --- a/clients/guzzle5-adapter.rst +++ b/clients/guzzle5-adapter.rst @@ -37,7 +37,7 @@ Then create the adapter:: $adapter = new GuzzleAdapter($guzzle, new GuzzleMessageFactory()); -Or if you installed the :ref:`discovery ` layer:: +Or if you installed the :doc:`discovery ` layer:: use Http\Adapter\Guzzle5\Client as GuzzleAdapter; diff --git a/clients/includes/install-discovery.inc b/clients/includes/install-discovery.inc index 08ece21..68c431d 100644 --- a/clients/includes/install-discovery.inc +++ b/clients/includes/install-discovery.inc @@ -1,4 +1,4 @@ -Alternatively you can install the :ref:`discovery ` layer +Alternatively you can install the :doc:`discovery ` layer to be able to automatically find installed resources, like factories: .. code-block:: bash diff --git a/clients/includes/install-message-factory.inc b/clients/includes/install-message-factory.inc index 13de8c7..6ef7db4 100644 --- a/clients/includes/install-message-factory.inc +++ b/clients/includes/install-message-factory.inc @@ -3,16 +3,16 @@ to install one as well (for example `Guzzle PSR-7`_): .. code-block:: bash -$ composer require guzzlehttp/psr7 + $ composer require guzzlehttp/psr7 In order to provide full interoperability, message implementations are -accessed through :ref:`factories `. Message factories for -`Diactoros`_ are `Guzzle PSR-7`_ implementations are available in the -:ref:`message ` component: +accessed through :doc:`factories `. Message factories for +`Diactoros`_ and `Guzzle PSR-7`_ are available in the +:doc:`message ` component: .. code-block:: bash -$ composer require php-http/message + $ composer require php-http/message .. _Diactoros: http://docs.guzzlephp.org/en/5.3/ .. _Guzzle PSR-7: https://github.com/guzzle/psr7