Integrations
While Caribou can do a lot by itself, its power is enhanced through integrations. Integrations are scripts/plugins that you install right in your control panel (Administration > Integrations) that enhance or extend Caribou's functionality, often through connections with other services or applications. Example integrations include forum software, payment gateways, shipping notifiers, and form plugins.
Writing Integrations
Before integrations can be installed, they must be dropped into the /includes/integrations/ folder. The filename of the integration must adhere to the following format guideline:
[integration name]_[integration type].php // ex: authnet_gateway.php // ex: phpbb_forum.php
Each type of integration (forum, form, shipping, and gateway) share three common functions that are used to install and edit the integration in the control panel. These functions are as follows:
- int_[integration name]_[integration type]_install()
- e.g. int_phpbb_forum_install()
- This function adds the integration into the database along with a base64_encoded, serialized array of its settings with default values.
- int_[integration name]_[integration type]_update()
- e.g. int_authnet_gateway_update()
- This function is executed before each time the "Edit Settings" screen is loaded for the integration.
- In most cases, it is left blank. However, sometimes it is useful to pre-edit the settings based on updates to the Caribou system. For example, you may want to add recently-added usergroups to a setting’s list of available options.
- int_[integration name]_[integration type]_settings()
- e.g. int_direct_shipping_settings()
- This is not a completely required function but rather a function included standard in all first-party integrations.
- It takes the base64_encoded, serialized array stored in the database and returns a PHP array.
- Most functions in the integration will begin with a call to this function like so:
$settings = int_phpbb_forum_settings();
The rest of the functions in an integration depend on the type of the integration being written. Each of these functions is detailed below. It should be noted that the best way to learn how to write integrations is to look at the included integrations with Caribou.
Note to developers: Each integration function can only be passed one argument and it is passed as a reference. In the following sections, the keys of that argument (an array) are listed and extra details are given if necessary. Be wary of modifying the argument directly because, being passed by reference, changes you make to it will be passed on to the rest of the script. However, this can come in handy in some cases. More details on these situations are below.
