File tree 1 file changed +37
-2
lines changed
1 file changed +37
-2
lines changed Original file line number Diff line number Diff line change 1
1
CakePHP Adapter
2
2
===============
3
3
4
- An HTTPlug adapter for the CakePHP HTTP client.
4
+ An HTTPlug adapter for the ` CakePHP HTTP client `_ .
5
5
6
6
Installation
7
7
------------
@@ -20,4 +20,39 @@ not yet included in your project), run:
20
20
Usage
21
21
-----
22
22
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
You can’t perform that action at this time.
0 commit comments