Skip to content

Latest commit

 

History

History
53 lines (31 loc) · 1.21 KB

cakephp-adapter.rst

File metadata and controls

53 lines (31 loc) · 1.21 KB

CakePHP Adapter

An HTTPlug adapter for the CakePHP HTTP client.

Installation

To install the CakePHP adapter, which will also install CakePHP itself (if it was not yet included in your project), run:

$ composer require php-http/cakephp-adapter

Usage

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;

$adapter = new CakeAdapter($cakeClient);

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.