rapidwebltd/SimpleMailChimp


🐵 Simple MailChimp API wrapper

License: LGPL-3.0

Language: PHP

Keywords: mailchimp, mailchimp-api, php-library


🐵 SimpleMailChimp

SimpleMailChimp is a simplified wrapper for common MailChimp functionality.

Simple MailChimp usage

Installation

To install this package, just use composer.

composer require rapidwebltd/simplemailchimp

If your framework does not already do so, you must add require_once "vendor/autoload.php" to any files in which you wish to use SimpleMailChimp.

Getting Started

In order to create a SimpleMailChimp object, call the getByAPIKey function from the SimpleMailChimpFactory and pass it your API key.

$simpleMailChimp = SimpleMailChimpFactory::getByAPIKey('API_KEY_GOES_HERE');

Subscribing a user to a list

To subscribe a user to a list call the subscribe function and pass through the MailChimp list id and the user's email.

$simpleMailChimp->subscribe('LIST_ID_GOES_HERE', 'example@example.com');

If successful it will return an array containing the subscriber's data.

Unsubscribing a user from a list

To unsubscribe a user from a list call the unsubscribe function and pass through the MailChimp list id and the user's email.

$simpleMailChimp->unsubscribe('LIST_ID_GOES_HERE', 'example@example.com');

If successful it will return an array containing the subscriber's data.

Getting a subscriber's details

To get the details of a specific subscriber from a list call the getSubscriberDetails function and pass through the MailChimp list id and the user's email.

$simpleMailChimp->getSubscriberDetails('LIST_ID_GOES_HERE', 'example@example.com');

If successful it will return an array containing the subscriber's data.

Checking to see if a subscriber is already on a list and subscribed

To see if a subscriber is already on a list and is subscribed call the isSubscribedToList function and pass through the MailChimp list id and the user's email.

$simpleMailChimp->isSubscribedToList('LIST_ID_GOES_HERE', 'example@example.com');

This function will return TRUE if the subscriber is found on the list AND is subscribed to it and return FALSE if either the user is not found on the list OR is in the list but set to unsubscribed.

Getting all the members of a list

To get all the members of a list call the getAllUsersInList function and pass through the MailChimp list id and a comma separated list of the specific fields you want to return. If no parameters are set it retrieves the member's email by default.

$simpleMailChimp->getAllUsersInList('LIST_ID_GOES_HERE');

Will return an array of emails belonging to members of the list specified.

$simpleMailChimp->getAllUsersInList('LIST_ID_GOES_HERE','email_address,status');

Will return an array of emails and the relevant statuses belonging to members of the list specified. Available parameters can be found on the MailChimp API documentation page (under 'Response body parameters' -> 'members' -> 'Show properties'): http://developer.mailchimp.com/documentation/mailchimp/reference/lists/members/#read-get_lists_list_id_members.

Note that this function returns all members of a list regardless of whether they are subscribed or not.

Project Statistics

Sourcerank 4
Repository Size 214 KB
Stars 1
Forks 1
Watchers 5
Open issues 0
Dependencies 2
Contributors 3
Tags 9
Created
Last updated
Last pushed

Top Contributors See all

AndyMac2508 Jordan Hall kirsty-gasston

Packages Referencing this Repo

rapidwebltd/simplemailchimp
A simple MailChimp API wrapper, SimpleMailChimp makes it easy to pass data back and forth between...
Latest release v1.0.8 - Updated - 1 stars

Recent Tags See all

v1.0.8 January 30, 2018
v1.0.7 February 22, 2017
v1.0.6 December 14, 2016
v1.0.5 November 03, 2016
v1.0.4 November 03, 2016
v1.0.3 November 03, 2016
v1.0.2 November 02, 2016
v1.0.1 November 02, 2016
v1.0 November 02, 2016

Something wrong with this page? Make a suggestion

Last synced: 2018-09-07 06:59:43 UTC

Login to resync this repository