Prolix MailchimpBundle for API V2.0
Symfony2.x bundle for
MailChimp API V2 and Export API API V1
Wrapper bundle that makes accessing Mailchimp functions easily in object oriented using method chaining, (*1)
License, (*2)
ProlixMailChimpBundle released under MIT LICENSE, (*3)
Supported API Methods
Campaigns related, (*4)
campaigns/create
campaigns/content
campaigns/list
campaigns/delete
campaigns/pause
campaigns/ready
campaigns/replicate
campaigns/ready
campaigns/resume
campaigns/send
campaigns/send-test
campaigns/segment-test
campaigns/schedule
campaigns/schedule-batch
campaigns/unschedule
campaigns/update
Lists related, (*5)
lists/abuse-reports
lists/activity
lists/subscribe
lists/unsubscribe
lists/member-info
lists/interest-groupings
lists/interest-grouping-add
lists/interest-grouping-del
lists/interest-grouping-update
lists/interest-group-add
lists/interest-group-update
lists/interest-group-del
Templates related, (*6)
templates/add
templates/list
templates/del
templates/info
templates/undel
Need support for a method not on the list submit an issue, (*7)
Setup
Step 1: Download ProlixMailchimp using composer
Add ProlixMailchimp in your composer.json:, (*8)
{
"require": {
"prolixtechnikos/mailchimp-bundle": "dev-master"
}
}
Now tell composer to download the bundle by running the command:, (*9)
``` bash
$ php composer.phar update "prolixtechnikos/mailchimp-bundle", (*10)
Composer will install the bundle to your project's `vendor/prolixtechnikos/mailchimp-bundle` directory.
### Step 2: Enable the bundle
Enable the bundle in the kernel:
``` php
get('mailchimp');
?>
Examples
Create new campaign
``` php
get('mailchimp.campaign');
$data = $campaignApi->create('regular',
array(
'list_id' => 'xxxxxxxx',
'from_name' => 'Ravindra Khokharia',
'from_email' => 'ravindrakhokharia@gmail.com',
'subject' => 'Subscribe to Prolix NewsLetter',
'to_name' => 'ProlixTechnikos Subscriber'),
array(
'archive' => 'test'
'sections' => array(),
'text' => 'test',
'html' => 'Test HTML Data',
'url' => 'http://www.prolixtechnikos.com',
));
var_dump($data);
?>, (*11)
###Delete existing campaign
``` php
get('mailchimp.campaign');
$data = $campaignApi->setCampaignId('xxxxxxxx')->delete();
var_dump($data);
?>
Send campaign
``` php
get('mailchimp.campaign');
$data = $campaignApi->setCampaignId('xxxxxxxx')->send();
var_dump($data);
?>, (*12)
###Subscribe new user to list
``` php
<?php
$listApi = $this->get('mailchimp.list');
$data = $listApi->subscribe('subscriber@prolixtechnikos.com');
var_dump($data);
?>
Note that the user will be subscriber to the default list set in config.yml
if you want to change the list for this time only, you can use
php
get('mailchimp.list');
$data = $listApi->setListId('xxxxxxx')
->subscribe('subscriber@prolixtechnikos.com');
var_dump($data);
?>
, (*13)