Yii2 MailChimp extension to manage the Mailchimp Email Marketing Platform:
- Website: https://www.mailchimp.com/
- PHP API: https://github.com/drewm/mailchimp-api
- Documentation: https://developer.mailchimp.com/documentation/mailchimp/
The preferred way to install this extension is through composer.
Either run
$ php composer.phar require cinghie/yii2-mailchimp "*"
or add
"cinghie/yii2-mailchimp": "*"
Set on your configuration file
use cinghie\mailchimp\components\Mailchimp as MailchimpComponent;
use cinghie\mailchimp\Mailchimp;
'components' => [
'mailchimp' => [
'class' => MailchimpComponent::class,
'apiKey' => 'YOUR_MAILCHIMP_API_KEY'
],
],
'modules' => [
'mailchimp' => [
'class' => Mailchimp::class,
'showFirstname' => true,
'showLastname' => true
]
]
Override controller example, on modules config
'modules' => [
'mailchimp' => [
'class' => Mailchimp::class,
'controllerMap' => [
'default' => 'app\controllers\DefaultController',
]
]
],
Override view example, on components config
'components' => [
'view' => [
'theme' => [
'pathMap' => [
'@cinghie/mailchimp/views/default' => '@app/views/mailchimp/default',
],
],
],
],
\Yii::$app->mailchimp;
\Yii::$app->mailchimp->getClient();
\Yii::$app->mailchimp->getLists();
\Yii::$app->mailchimp->getListMembers($listID);
<?= Subscription::widget([
'list_id' => 'MYLISTID' // if not set raise Error
]) ?>
alternative to list_id you can set an list_array to set a list_id to a specific language
<?= Subscription::widget([
'list_array' => [
'en' => 'MYLISTID_EN',
'es' => 'MYLISTID_ES',
'it' => 'MYLISTID_IT',
]
]) ?>
- Lists View: PathToApp/index.php?r=mailchimp/default/lists
- Lists View with Pretty Urls: PathToApp/mailchimp/default/lists
- List View: PathToApp/index.php?r=mailchimp/default/list?id=XXX&name=XXX
- List View with Pretty Urls: PathToApp/mailchimp/default/list?id=XXX&name=XXX