Skip to content

Latest commit

 

History

History
86 lines (60 loc) · 2.47 KB

README.md

File metadata and controls

86 lines (60 loc) · 2.47 KB

Laravel Campaign Monitor Bundle

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.

Setup

  1. Copy the sample config file (config/campaignmonitor-sample.php) to application/config/campaignmonitor.php.
  2. 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

Bundle Registration

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');

Usage

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

Examples

Get a list of all available timezones

$timezones = CampaignMonitor::general()->get_timezones();

Get a list of all the subscriber lists for a client

CampaignMonitor::clients($client_id)->get_lists();

Get a list of active subscribers on a list from 1st March 2012

CampaignMonitor::lists($list_id)->get_active_subscribers('2012-03-01');