PHP code example of lorddashme / php-mailchimp

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

    

lorddashme / php-mailchimp example snippets




ordDashMe\MailChimp\MailChimp;

$apiKey = 'abcde12345...';

$mailchimp = new MailChimp($apiKey);

$listId = 'qwerty12345...';

$mailchimp->post("list/{$listId}/members", function ($requestBody) {
    $requestBody->email_address = '[email protected]';
    return $requestBody;
});

// If you want to investigate the current request details.
$mailchimp->getRequest();

// To get the response from the MailChimp API service.
// Response: {"response_body": {...}", "header": {"response_http_code": ...}}
$response = $mailchimp->getResponse();



ordDashMe\MailChimp\Facade\MailChimp;

$apiKey = 'abcde12345...';

MailChimp::init($apiKey);

$listId = 'qwerty12345...';

MailChimp::post("list/{$listId}/members", array(
    'email_address' => '[email protected]'
));

MailChimp::getRequest();

// Response: {"response_body": {...}", "header": {"response_http_code": ...}}
$response = MailChimp::getResponse();
txt
composer 
post('route', closure/array);
get('route');
patch('route', closure/array);