i am using this mailchimp-api according to the documentation i should just place
use \DrewM\MailChimp\MailChimp;
$MailChimp = new MailChimp('abc123abc123abc123abc123abc123-us1');
directory structure
index.php (this is where i call any library i use using
use
)composer.json
-
vendor (this is the folder that contains all libraries from git and the autoload file)
-- drewm
--- mailchimp-api
---- src (this folder contains the Mailchimp.php that has
namespace DrewM\MailChimp;
) -
configs (config directory)
-- functions.php (this file contains the function for mailchimp)
now whenever i call this mailchimp()
function i get
Fatal error: Uncaught Error: Class 'DrewM\MailChimp\MailChimp' not found
composer.json file
{
"require": {
"drewm/mailchimp-api": "^2.4",
"ircmaxell/random-lib": "^1.2",
"phpmailer/phpmailer": "^5.2"
}
}
index.php
require_once './vendor/autoload.php';
require_once './config/functions.php';
functions.php
use \DrewM\MailChimp\MailChimp;
function mailchimp(){
$MailChimp = new MailChimp('abc123abc123abc123abc123abc123-us1');
$result = $MailChimp->get('lists');
print_r($result);
}