Name: laravel-mailchimp-segment
Owner: Caldera Labs
Description: Simple Laravel service for MailChimp Segments
Created: 2017-01-30 02:55:54.0
Updated: 2017-01-30 03:39:40.0
Pushed: 2017-02-19 00:13:54.0
Homepage: null
Size: 9
Language: PHP
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Simple Laravel service for MailChimp Segments
MAILCHIMP_APIKEY='123344dfff-us10'
\calderawp\mailchimp\segments\PackageServiceProvider::class
Primary usage is to add or remove emails from segments, but lower-level APIs are provided.
NOTE: $listId
and $segmentId
are assumed
//create object for segment
$segement = \calderawp\mailchimp\segments\Factory::segment( config('mailchimp-segments.apiKey'), $listId, ) $segmentId );
$emails = $segment->getEmails();
//create object for segment
$segement = \calderawp\mailchimp\segments\Factory::segment( config('mailchimp-segments.apiKey'), $listId, ) $segmentId );
//$emials will contain all emails in segment after update
//Note, addresses not in list are ignored
$emails = $segement->addEmails([
'frodo@bagend.com',
'bilbo@bagend.com'
]);
//create object for segment
$segement = \calderawp\mailchimp\segments\Factory::segment( config('mailchimp-segments.apiKey'), $listId, $segmentId );
//$emials will contain all emails in segment after update
//Note, addresses not in list are ignored
$emails = $segement->removeEmails([
'sam@bagend.com',
]);
$segmentAPI = \calderawp\mailchimp\segments\Factory::segments( config('mailchimp-segments.apiKey') );
$listId = 'f402a6993d';
$segmentAPI->create( $listId, [
'frodo@bagend.com',
'bilbo@bagend.com'
],'Test Segment' );
$segmentAPI = \calderawp\mailchimp\segments\Factory::segments( config('mailchimp-segments.apiKey') );
$listId = 'f402a6993d';
$segments = $segmentAPI->segments( $listId );
$lists = \calderawp\mailchimp\segments\Factory::lists( config('mailchimp-segments.apiKey') );
$ids = $lists->getListIds();
$segments = [];
foreach( $ids as $listId ){
$segmentAPI = \calderawp\mailchimp\segments\Factory::segments( config('mailchimp-segments.apiKey') );
$s = $segmentAPI->segments( $listId );
$segments = array_merge($segments, $s );
}
Copyrigtht 2017 CalderaWP LLC - License: GPL V2 or later