PHP code example of altelma / laravel-mailchimp

1. Go to this page and download the library: Download altelma/laravel-mailchimp 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/ */

    

altelma / laravel-mailchimp example snippets


$app->configure('mailchimp');

$app->withFacades();

if (!class_exists('MailChimp')) {
    class_alias('Altelma\LaravelMailChimp\LaravelMailChimp', 'MailChimp');
}

php artisan vendor:publish

$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);