prolixtechnikos / mailchimp-bundle
Mailchimp v2.0 API Wrapper
Installs: 223
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.3.2
- ext-curl: *
- kriswallsmith/buzz: >=0.7
- symfony/framework-bundle: 2.*
This package is auto-updated.
Last update: 2024-09-11 22:02:13 UTC
README
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
ProlixMailChimpBundle 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/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
templates/add
templates/list
templates/del
templates/info
templates/undel
Need support for a method not on the list submit an issue
Setup
Step 1: Download ProlixMailchimp using composer
Add ProlixMailchimp in your composer.json:
{ "require": { "prolixtechnikos/mailchimp-bundle": "dev-master" } }
Now tell composer to download the bundle by running the command:
$ php composer.phar update "prolixtechnikos/mailchimp-bundle"
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 // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Prolix\MailchimpBundle\ProlixMailchimpBundle(), ); }
Step 3: Add configuration
# app/config/config.yml prolix_mailchimp: api_key: xxxxxxx-us5 default_list: xxxxxxxx ssl: true #optional configuring curl connection # this will hold the curl options. Just use the php curl option constant as key and value curl_options: curlopt_useragent: ProlixMailChimp curlopt_timeout: 30
Usage
Using service
<?php $mailchimp = $this->get('mailchimp'); ?>
##Examples
###Create new campaign
<?php $campaignApi = $this->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' => '<b>Test HTML Data</b>', 'url' => 'http://www.prolixtechnikos.com', )); var_dump($data); ?>
###Delete existing campaign
<?php $campaignApi = $this->get('mailchimp.campaign'); $data = $campaignApi->setCampaignId('xxxxxxxx')->delete(); var_dump($data); ?>
###Send campaign
<?php $campaignApi = $this->get('mailchimp.campaign'); $data = $campaignApi->setCampaignId('xxxxxxxx')->send(); var_dump($data); ?>
###Subscribe new user to list
<?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 $listApi = $this->get('mailchimp.list'); $data = $listApi->setListId('xxxxxxx') ->subscribe('subscriber@prolixtechnikos.com'); var_dump($data); ?>