Skip to content

Add CakePHP adapter documentation. Fixes #155 #209

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

Merged
merged 1 commit into from
Jul 22, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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