oneup/mailchimp-api-v3

Simple PHP library for MailChimp API V3

2.7.1 2023-07-11 11:53 UTC

This package is auto-updated.

Last update: 2024-12-18 09:41:50 UTC


README

This is a basic PHP wrapper for the MailChimp API V3 for subscribe/unsubscribe to/from lists.

Author Software License Total Downloads

Examples

Subscribe

$mc = new \Oneup\MailChimp\Client('thisShouldBeYourApiKeyFromMailChimp-us1');
$response = $mc->subscribeToList(
    'ea06b81001',           // List ID
    'foo@bar.baz',          // E-Mail address 
    [                       // Array with first/lastname (MailChimp merge tags) 
        'FNAME' =>  'Foo',
        'LNAME' => 'Bar',
    ],
    true                    // Double opt-in true
);

Unsubscribe

$mc = new \Oneup\MailChimp\Client('thisShouldBeYourApiKeyFromMailChimp-us1');
$response = $mc->unsubscribeFromList('yourListId', 'foo@bar.baz');