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
License
HypeMailChimp bundle released under MIT LICENSE
#Supported API Methods
Campaigns related
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
lists/list
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
lists/segments
lists/segment-test
Templates related
templates/add
templates/list
templates/del
templates/info
templates/undel
Export API
list
campaignSubscriberActivity
Helper related
helper/ping
Need support for a method not on the list submit an issue
Add HypeMailchimp in your composer.json:
{
"require": {
"ahmedsamy/hype-mailchimp-bundle": "dev-master"
}
}
Now tell composer to download the bundle by running the command:
$ php composer.phar update "ahmedsamy/hype-mailchimp-bundle"
Composer will install the bundle to your project's vendor/ahmedsamy/hype
directory.
Enable the bundle in the kernel:
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Hype\MailchimpBundle\HypeMailchimpBundle(),
);
}
# app/config/config.yml
hype_mailchimp:
api_key: xxxxxxx-us5
default_list: xxxxxxxx
ssl: true #optional configuring curl connection
Using service
<?php
$mailchimp = $this->get('hype_mailchimp');
?>
##Examples
###Create new campaign
<?php
$mc = $this->get('hype_mailchimp');
$data = $mc->getCampaign()->create('regular', array(
'list_id' => '93419bbdc0',
'subject' => 'test created subject',
'from_email' => '[email protected]',
'from_name' => 'Ahmed Samy',
'to_name' => 'fans'
), array(
'html' => '<h5>Html content</h5>',
'sections' => array(),
'text' => 'test',
'url' => 'http://www.example.com',
'archive' => 'test'
));
var_dump($data);
?>
###Delete existing campaign
<?php
$mc = $this->get('hype_mailchimp');
$data = $mc->getCampaign()
->setCi('1088b4ed65')
->del();
var_dump($data);
?>
###Send campaign
<?php
$mc = $this->get('hype_mailchimp');
$data = $mc->getCampaign()
->setCi('1088b4ed65')
->send();
var_dump($data);
?>
###Subscribe new user to list
<?php
$mc = $this->get('hype_mailchimp');
$data = $mc->getList()
->subscribe('[email protected]');
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
$mc = $this->get('hype_mailchimp');
$data = $mc->getList()
->setListId('xxxxxxx')
->addMerge_vars(
array(
'mc_notes' => 'test notes'
))
->subscribe('[email protected]');
?>