2017 © Pedro Peláez
 

library zf2-mailchimp

A Mailchimp 1.3 API module for Zend Framework 2.0

image

aaron4m/zf2-mailchimp

A Mailchimp 1.3 API module for Zend Framework 2.0

  • Friday, September 27, 2013
  • by aaron4m
  • Repository
  • 2 Watchers
  • 6 Stars
  • 345 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

ZF2 Mailchimp 1.3 API Wrapper

This module is an attempt to create a complete mailchimp API wrapper for Zend Framework 2.0 At the moment, this is loosely based on https://github.com/waynhall/CodeIgniter-Library-for-MailChimp-API-v1.3, (*1)

*This is very much a work in progress and functionality will be added as I have time and/or need., (*2)

Updates

12/04/2013 - Major overhaul of service/mapper architecture. 14/04/2013 - Rewrote the submit mechanism and cleaned up subscriber service., (*3)

Contributing

If you want to see this module move along faster, please feel free to pick a section, start coding and submit pull requests! I'm interested in contributions for - Unit Tests - Add other sections not yet completed - Code improvements (I'm still learning, so would appreciate feedback), (*4)

Installation

1) Add the following requirement to your projects composer.json file., (*5)

"aaron4m/zf2-mailchimp": "dev-master"

2) Open up your command line and run, (*6)

php ./composer.phar update

3) Copy vendor/aaron4m/zf2-mailchimp/config/mailchimp.local.php.dist to your /config/autoload folder and rename it to mailchimp.local.php 4) You must add your API key to this file and configure any global settings., (*7)

Usage Examples

Subscribe (Single)

$mailchimp = $this->getServiceLocator()->get('subscriber');

$mailchimp->email('me@here.com.au')
  ->listId('29bc73c393')
  ->emailType('html')
  ->subscribe();

Subscribe (Bulk)

$mailchimp = $this->getServiceLocator()->get('subscriber');

$mailchimp->listId('12345')
  ->batch(array(
    array('EMAIL'=>'me@here.com', 'EMAIL_TYPE'=>'html', 'FNAME'=>'Aaron'),
    array('EMAIL'=>'me2@here.com', 'EMAIL_TYPE'=>'html', 'FNAME'=>'Bill'),
  ))
  ->subscribe();

Unsubscribe (Single)

$mailchimp = $this->getServiceLocator()->get('subscriber');

$mailchimp->email('me@here.com.au')
    ->listId('29bc73c393')
    ->unsubscribe();

Unsubscribe (Bulk)

$mailchimp = $this->getServiceLocator()->get('subscriber');

$subscribe->listId('29bc73c393')
  ->batch(array('me@here.com', 'me2@here.com'))
  ->unsubscribe();

Update (Single)

$mailchimp = $this->getServiceLocator()->get('subscriber');

$mailchimp->listId('12345')
  ->email('me@here.com')
  ->mergeVars(array(
    array('FNAME'=>'Aaron'),
  ))
  ->update();

Update (Bulk)

$mailchimp = $this->getServiceLocator()->get('subscriber');

$mailchimp->listId('12345')
  ->batch(array(
    array('EMAIL'=>'me@here.com', 'FNAME'=>'Aaron'),
    array('EMAIL'=>'me2@here.com', 'FNAME'=>'Billy'),
  ))
  ->update();

Get Member Info (Single)

  • You can return this as an array or a subscriber entity
$mailchimp = $this->getServiceLocator()->get('subscriber');

$subscriberDetails = $mailchimp->email('aaron@4mation.com.au')
  ->listId('29bc73c393')
  ->get();

The Versions

27/09 2013

dev-master

9999999-dev https://github.com/aaron4m/zf2-mailchimp

A Mailchimp 1.3 API module for Zend Framework 2.0

  Sources   Download

New BSD License

The Requires

  • php >=5.3.3

 

zf2 mailchimp zend-framework