1. Go to this page and download the library: Download pacely/mailchimp-apiv3 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/ */
return [
/*
|--------------------------------------------------------------------------
| Mailchimp API key
|--------------------------------------------------------------------------
|
| To obtain an API key, go to mailchimp.com under your profile
| you will find Extras -> API keys. Paste the key below.
|
*/
'apikey' => ''
];
request($resource, $arguments = [], $method = 'GET') // $arguments is used as POST data or GET parameters, depending on the method used.
$mc = new Mailchimp('<api-key>', '<guzzle-options[array]>');
// Get 10 lists starting from offset 10 and fset' => 10,
'count' => 10
]);
// Will fire this query:
// GET https://us1.api.mailchimp.com/3.0/lists?fields=lists.id,lists.name,lists.stats.member_count&count=10
// Returns object(Illuminate\Support\Collection)
var_dump($result);
// Returns the first item
var_dump($result->first());
// Returns 3 items
var_dump($result->take(3));
// Returns a JSON string
var_dump($result->toJson());
// Returns an array
var_dump($result->toArray());