alexgoncharcherkassy / mailchimpbundle
Simple bundle for Mailchimp
Installs: 2
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^7.2
- ext-json: *
- guzzlehttp/guzzle: ~6.0
- sensio/framework-extra-bundle: ^3.4|^4.0|^5.0
- symfony/framework-bundle: ^3.4|^4.0
- symfony/orm-pack: *
- symfony/serializer-pack: *
- symfony/yaml: ^3.4|^4.0
Requires (Dev)
- phpunit/phpunit: ^7
- symfony/browser-kit: ^3.0|^4.0
- symfony/phpunit-bridge: *
This package is auto-updated.
Last update: 2024-12-20 01:46:09 UTC
README
Composer
php composer.phar require alexgoncharcherkassy/mailchimpbundle
AppKernel
public function registerBundles()
{
$bundles = array(
...
new AlexCk\MailchimpBundle\AlexCkMailchimpBundle()
Usage
1. Getting service
$mailchimp = $this->get('alexck_mailchimp.client');
$mailchimp->configure('username', 'key', '3.0');
2. Get mailchimp lists and webhooks
$lists = $mailchimp->getLists();
3. Create mailchimp list
$contact = new ListItemContact();
$contact
->setAddress1('adr1')
...
;
$campaign = new ListItemCampaignDefaults();
$campaign
->setFromName('fromName')
...
;
$item = new ListItem();
$item
->setId('id1')
...
->setContact($contact)
->setCampaignDefaults($campaign);
$list = $mailchimp->createList($item);
4. Create mailchimp member
$member = new Member();
$member
->setId('id1')
...
;
$member = $mailchimp->createMember($member, 'listId');
5. Update mailchimp member
$mergedFields = new MemberMergeFields();
$mergedFields
->setFName('fName')
->setLName('lName');
$member = new Member();
$member
->setId('id1')
...
->setMergeFields($mergedFields);
$member = $mailchimp->updateMember($member, 'listId', 'old_email@email.com');
6. Delete mailchimp member
$member = new Member();
$member
->setId('id1')
...
;
$member = $mailchimp->deleteMember($member, 'listId');
7. Create mailchimp webhooks unsubscribe
$webhook = $mailchimp->createWebHookEventUnsubscribe('listId', 'email_member@email.com');
8. Create batch members
$member = new Member();
$member
->setId('id1')
...
;
$batchResp = $mailchimp->createBatchMember('listId', [$member]);