PHP code example of oneup / mailchimp-api-v3

1. Go to this page and download the library: Download oneup/mailchimp-api-v3 library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

oneup / mailchimp-api-v3 example snippets


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

$mc = new \Oneup\MailChimp\Client('thisShouldBeYourApiKeyFromMailChimp-us1');
$response = $mc->unsubscribeFromList('yourListId', '[email protected]');