A packages provides you to connect mailchimp API v3
-
Run
$ composer require altelma/laravel-mailchimp
-
(Only for Laravel 5.5 or minor) Add provider to config/app.php
providers => [
Altelma\LaravelMailChimp\MailChimpServiceProvider::class
],
Make sure you never use "MailChimp" or exists this in your project. After you finish config all run artisan to create config
php artisan vendor:publish
For optional if you want to use Alias class you can add this to config/app.php
aliases => [
'MailChimp' => ALtelma\LaravelMailChimp\MailChimpFacade::class
]
- Add provider to
bootstrap/app.php
$app->register(Altelma\LaravelMailChimp\MailChimpServiceProvider::class);
-
Copy
vendor/altelma/laravel-mailchimp/config/mailchimp.php
toconfig/mailchimp.php
-
Add config to
bootstrap/app.php
$app->configure('mailchimp');
- Allow call package via Facade, uncomment
$app->withFacades();
if (!class_exists('MailChimp')) {
class_alias('Altelma\LaravelMailChimp\LaravelMailChimp', 'MailChimp');
}
$mc = new MailChimp('Your API KEY');
$results = $mc->get('lists/your_directory_list/members');
echo json_decode($results);
// or
return reponse()-json($results);
// With Alias
$results = MailChimp::get('lists/your_directory_list/members');
echo json_decode($results);
// or
return reponse()-json($results);
This package is not perfect right, but it can improve together. If you've found bug or have any suggestions. Send that to me or create a new issue. Thank you to use it.