This is a Laravel bundle for the Campaign Monitor API wrapper.
It uses the official API wrapper, which is described on the Campaign Monitor website as:
A comprehensive PHP library which implements the complete functionality of v3 of the Campaign Monitor API including graceful error handling.
- Copy the sample config file (
config/campaignmonitor-sample.php
) toapplication/config/campaignmonitor.php
. - Enter your [API key] into the file.
Help on finding your API key and all the other API IDs mentioned below can be found on the Getting Started section of the Campaign Monitor API site
Either auto-load by entering the following code in application/bundles.php
...
'campaignmonitor' => array(
'auto' => true
),
...or load it each time you need it by using:
Bundle::start('campaignmonitor');
All calls should be started with:
CampaignMonitor::LIBRARY(LIBRARY_ID);
LIBRARY
should be replaced with one item from the list below depending on the interaction required. LIBRARY_ID
should be replaced with the API ID for that library. See the example below for help.
- administrators
- campaigns - requires campaign id
- clients - requires client id
- general
- lists - requires list id
- people - require client id
- segments - requires segment id
- subscribers - requires list id
- templates - requires template id
IMPORTANT: Please note all of the library names are plural except general.
All the functions in the API are covered. You can find details on them all on the Campaign Monitor API website or by browsing the following files:
vendor/csrest_administrators.php
vendor/csrest_campaigns.php
vendor/csrest_clients.php
vendor/csrest_general.php
vendor/csrest_lists.php
vendor/csrest_people.php
vendor/csrest_segments.php
vendor/csrest_subscribers.php
vendor/csrest_templates.php
$timezones = CampaignMonitor::general()->get_timezones();
CampaignMonitor::clients($client_id)->get_lists();
CampaignMonitor::lists($list_id)->get_active_subscribers('2012-03-01');