Skip to content
This repository has been archived by the owner on Jan 21, 2023. It is now read-only.

devlibrary/mailchimp-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Devlib/MailChimp-API

Simple MailChimp API Wrapper

Install

composer require devlib/mailchimp-api

Usage

use DevLib\API\MailChimp\MailChimp;

$apiKey  = getenv('MC_API_KEY');
$list_id = getenv('MC_LIST_ID');

$api     = new MailChimp($apiKey, $list_id);

Subscribe user

use DevLib\API\MailChimp\MailChimp;
use MailChimpAPIException

$email = 'you@example.com';

try{

    $api->subscribe($email, [
        'FNAME' => 'Emma',
        'LNAME' => 'Doe'
    ]);

}catch(MailChimp\MailChimpAPIException $e){
    echo ( 'Error: ' . $e->getMessage() );
}