Mailchimp PHP is a PHP library developed to include and simplify the creation and connection between websites, online applications and Mailchimp.
Just PHP 5.6+ is required. Let's start downloading the mailchimp-php library, then extract it to your_server_path/
.
Import the mailchimp.php
file to any .php
file where you need to use the Mailchimp PHP lib.
require_once("your_server_path/mailchimp.php");
Before using the Mailchimp PHP lib, You must create your ApiKey, then configure the lib at mailchimp-php/config.json
as following:
{
"api_key" : "y0ur4p1k3y-dc",
"dc" : null
}
Where:
api_key
= Required for any api requests;;dc
= Data Center to repoint manually your api requests (Ifnull
it will be automatically detected through theapi_key
);
All of these will be added to $mailchimp->config
. If You need to modify api_key
and/or dc
dynamically, You can change it as shown below:
// Modify MailChimp
$mailchimp->config->api_key = "YOUR_NEW_API_KEY-DC";
// Modify MailChimp Data Center
$mailchimp->config->dc = "YOUR_NEW_MANUAL_DC";
You are now ready to use the Mailchimp PHP lib as you wish! Everything you need to know about the library, such as Classes and "How To Use", is described here in the Wiki. I hope this library will help you coding for Mailchimp in PHP. Any suggestion or improvement is always welcome.
- First and beta release of mailchimp-php lib