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
*This is very much a work in progress and functionality will be added as I have time and/or need.
12/04/2013 - Major overhaul of service/mapper architecture. 14/04/2013 - Rewrote the submit mechanism and cleaned up subscriber service.
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)
- Add the following requirement to your projects composer.json file.
"aaron4m/zf2-mailchimp": "dev-master"
- Open up your command line and run
php ./composer.phar update
- Copy vendor/aaron4m/zf2-mailchimp/config/mailchimp.local.php.dist to your /config/autoload folder and rename it to mailchimp.local.php
- You must add your API key to this file and configure any global settings.
$mailchimp = $this->getServiceLocator()->get('subscriber');
$mailchimp->email('[email protected]')
->listId('29bc73c393')
->emailType('html')
->subscribe();
$mailchimp = $this->getServiceLocator()->get('subscriber');
$mailchimp->listId('12345')
->batch(array(
array('EMAIL'=>'[email protected]', 'EMAIL_TYPE'=>'html', 'FNAME'=>'Aaron'),
array('EMAIL'=>'[email protected]', 'EMAIL_TYPE'=>'html', 'FNAME'=>'Bill'),
))
->subscribe();
$mailchimp = $this->getServiceLocator()->get('subscriber');
$mailchimp->email('[email protected]')
->listId('29bc73c393')
->unsubscribe();
$mailchimp = $this->getServiceLocator()->get('subscriber');
$subscribe->listId('29bc73c393')
->batch(array('[email protected]', '[email protected]'))
->unsubscribe();
$mailchimp = $this->getServiceLocator()->get('subscriber');
$mailchimp->listId('12345')
->email('[email protected]')
->mergeVars(array(
array('FNAME'=>'Aaron'),
))
->update();
$mailchimp = $this->getServiceLocator()->get('subscriber');
$mailchimp->listId('12345')
->batch(array(
array('EMAIL'=>'[email protected]', 'FNAME'=>'Aaron'),
array('EMAIL'=>'[email protected]', 'FNAME'=>'Billy'),
))
->update();
- You can return this as an array or a subscriber entity
$mailchimp = $this->getServiceLocator()->get('subscriber');
$subscriberDetails = $mailchimp->email('[email protected]')
->listId('29bc73c393')
->get();