cerberus-docs / docs / developers.rst


We have made a library available that makes it easy for you to integrate Cerberus into your own addons. It is released under the MIT licence so you can use it for commercial purposes if required.

Cerberus Library Requirements

You must have the PHP MCRYPT and Curl extensions installed.

Cerberus Library Usage

The library can be used just like any other EE or CodeIgniter library. Here is an example of loading the library and passing in an array of configuration parameters an EE addon:


$params = array(
    'hostname' => parse_url($this->EE->config->item('site_url'), PHP_URL_HOST),
    'update_access_key' => 'your_access_key'

$this->EE->load->library('cerberus', $params);

The hostname and access key are the only required parameters. See the :doc:`updater/api` for full details of how to use the library.

You should then pass your data as a JSON-encoded array of arrays to the library encrypt method:


$data = array(
        'username' => 'username',
        'screen_name' => 'screen_name',
        'email' => 'email',
        'ip_address' => 'ip_address',
        'url' => 'url'

$encrypted = $this->EE->cerberus->encrypt(json_encode($data));


Note that you must send keys for all five member fields even if they are empty strings

Having encrypted your data you can now send it the Cerberus database:


$response = $this->EE->cerberus->update($encrypted);

If all goes will the $response will contain a JSON-encoded string indicating success:

{"code": 200, "message": "Ok"}

Please see :doc:`updater/response-codes` for all the possible API responses.

API and Response Codes