Skip to content

Commit 6114d45

Browse files
Nyholmsagikazarmark
authored andcommitted
Documentation for the Buzz adapter (#115)
* Documentation for the Buzz adapter. This will fix #99 * Typo
1 parent 38ed08c commit 6114d45

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

clients.rst

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Client adapters:
2020

2121
.. toctree::
2222

23+
clients/buzz-adapter
2324
clients/guzzle5-adapter
2425
clients/guzzle6-adapter
2526
clients/react-adapter

clients/buzz-adapter.rst

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
Buzz Adapter
2+
============
3+
4+
An HTTPlug adapter for the `Buzz HTTP client`_.
5+
6+
Installation
7+
------------
8+
9+
To install the Buzz adapter, which will also install Buzz itself (if it was
10+
not yet included in your project), run:
11+
12+
.. code-block:: bash
13+
14+
$ composer require php-http/buzz-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 Buzz client, you may pass any listener or configuration parameters to it
24+
like::
25+
26+
use Buzz\Browser;
27+
use Buzz\Client\Curl;
28+
use Buzz\Listener\CookieListener;
29+
30+
$browser = new Browser();
31+
32+
$client = new Curl();
33+
$client->setMaxRedirects(0);
34+
$browser->setClient($client);
35+
36+
// Create CookieListener
37+
$listener = new CookieListener();
38+
$browser->addListener($listener);
39+
40+
Then create the adapter::
41+
42+
use Http\Adapter\Buzz\Client as BuzzAdapter;
43+
use Http\Message\MessageFactory\GuzzleMessageFactory;
44+
45+
$adapter = new BuzzAdapter($browser, new GuzzleMessageFactory());
46+
47+
Or if you installed the :doc:`discovery </discovery>` layer::
48+
49+
use Http\Adapter\Buzz\Client as BuzzAdapter;
50+
51+
$adapter = new BuzzAdapter($browser);
52+
53+
.. warning::
54+
55+
The message factory parameter is mandatory if the discovery layer is not installed.
56+
57+
.. include:: includes/further-reading-sync.inc
58+
59+
.. _Buzz HTTP client: https://github.com/kriswallsmith/Buzz

0 commit comments

Comments
 (0)