Skip to content

Commit f19e87f

Browse files
authored
Merge pull request #209 from nickygerritsen/cakephp-adapter-docs
Add CakePHP adapter documentation. Fixes #155
2 parents 859818f + 21bf533 commit f19e87f

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

clients/cakephp-adapter.rst

+37-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CakePHP Adapter
22
===============
33

4-
An HTTPlug adapter for the CakePHP HTTP client.
4+
An HTTPlug adapter for the `CakePHP HTTP client`_.
55

66
Installation
77
------------
@@ -20,4 +20,39 @@ not yet included in your project), run:
2020
Usage
2121
-----
2222

23-
To be written...
23+
Begin by creating a CakePHP HTTP client, passing any configuration parameters you
24+
like::
25+
26+
use Cake\Http\Client as CakeClient;
27+
28+
$config = [
29+
// Config params
30+
];
31+
$cakeClient = new CakeClient($config);
32+
33+
Then create the adapter::
34+
35+
use Http\Adapter\Cake\Client as CakeAdapter;
36+
use Http\Message\MessageFactory\GuzzleMessageFactory;
37+
38+
$adapter = new CakeAdapter($cakeClient, new GuzzleMessageFactory());
39+
40+
.. note::
41+
42+
The client parameter is optional; if you do not supply it (or set it to
43+
``null``) the adapter will create a default CakePHP HTTP client without any options.
44+
45+
46+
Or if you installed the :doc:`discovery </discovery>` layer::
47+
48+
use Http\Adapter\Cake\Client as CakeAdapter;
49+
50+
$adapter = new CakeAdapter($cakeClient);
51+
52+
.. warning::
53+
54+
The message factory parameter is mandatory if the discovery layer is not installed.
55+
56+
.. include:: includes/further-reading-sync.inc
57+
58+
.. _CakePHP HTTP client: https://book.cakephp.org/3.0/en/core-libraries/httpclient.html

0 commit comments

Comments
 (0)