-
Notifications
You must be signed in to change notification settings - Fork 56
Guzzle 5 #84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Guzzle 5 #84
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,52 @@ | ||
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: | ||
|
||
.. code-block:: bash | ||
|
||
$ composer require php-http/guzzle5-adapter | ||
|
||
.. include:: includes/install-message-factory.inc | ||
|
||
.. include:: includes/install-discovery.inc | ||
|
||
Usage | ||
----- | ||
|
||
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 <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/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Alternatively you can install the :ref:`discovery <discovery>` layer | ||
to be able to automatically find installed resources, like factories: | ||
|
||
.. code-block:: bash | ||
|
||
$ composer require php-http/discovery |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe it's failing here as it miss the indent ? (not sure) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this does need an indention yes
|
||
|
||
In order to provide full interoperability, message implementations are | ||
accessed through :ref:`factories <message-factory>`. Message factories for | ||
`Diactoros`_ are `Guzzle PSR-7`_ implementations are available in the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Diactoros and Guzzle There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you mean remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace "are" by "and" :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, good catch. |
||
:ref:`message <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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you define a label discovery somewhere? if you want to link to the document discovery.rst, its
:doc:
.:ref:
is for linking to labels within some page (anchor links in the same or another page).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I thought I can just link to a page with the same name 😄