Skip to content

Commit

Permalink
Merge pull request #209 from nickygerritsen/cakephp-adapter-docs
Browse files Browse the repository at this point in the history
Add CakePHP adapter documentation. Fixes #155
  • Loading branch information
joelwurtz committed Jul 22, 2017
2 parents 859818f + 21bf533 commit f19e87f
Showing 1 changed file with 37 additions and 2 deletions.
39 changes: 37 additions & 2 deletions clients/cakephp-adapter.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CakePHP Adapter
===============

An HTTPlug adapter for the CakePHP HTTP client.
An HTTPlug adapter for the `CakePHP HTTP client`_.

Installation
------------
Expand All @@ -20,4 +20,39 @@ not yet included in your project), run:
Usage
-----

To be written...
Begin by creating a CakePHP HTTP client, passing any configuration parameters you
like::

use Cake\Http\Client as CakeClient;

$config = [
// Config params
];
$cakeClient = new CakeClient($config);

Then create the adapter::

use Http\Adapter\Cake\Client as CakeAdapter;
use Http\Message\MessageFactory\GuzzleMessageFactory;

$adapter = new CakeAdapter($cakeClient, new GuzzleMessageFactory());

.. note::

The client parameter is optional; if you do not supply it (or set it to
``null``) the adapter will create a default CakePHP HTTP client without any options.


Or if you installed the :doc:`discovery </discovery>` layer::

use Http\Adapter\Cake\Client as CakeAdapter;

$adapter = new CakeAdapter($cakeClient);

.. warning::

The message factory parameter is mandatory if the discovery layer is not installed.

.. include:: includes/further-reading-sync.inc

.. _CakePHP HTTP client: https://book.cakephp.org/3.0/en/core-libraries/httpclient.html

0 comments on commit f19e87f

Please sign in to comment.