panix/mod-mailchimp

Mailchimp to manage Mailchimp Email Platform in a Yii2 site.

dev-master 2020-05-29 11:53 UTC

This package is auto-updated.

Last update: 2024-10-29 06:30:54 UTC


README

License Latest Stable Version Latest Release Date Latest Commit Total Downloads

MailChimp extension to manage the Mailchimp Email Marketing Platform:

Installation

The preferred way to install this extension is through composer.

Either run

$ php composer.phar require panix/mod-mailchimp "*"

or add

"panix/mod-mailchimp": "*"

Configuration

Set on your configuration file

'modules' => [ 
    'mailchimp' => [
        'class' => 'panix\mod\mailchimp\Module',
        'showFirstname' => true,
        'showLastname' => true
    ]
]

Overrides

Override controller example, on modules config

'modules' => [ 

	'mailchimp' => [
		'class' => 'panix\mod\mailchimp\Module',
		'controllerMap' => [
			'default' => 'app\controllers\DefaultController',
		]
	]
	
],

Override view example, on components config

'components' => [ 

	'view' => [
		'theme' => [
			'pathMap' => [
				'@mailchimp/views/default' => '@app/views/mailchimp/default',
			],
		],
	],
	
],

Usage

\Yii::$app->mailchimp;
\Yii::$app->mailchimp->getClient();
\Yii::$app->mailchimp->getLists();
\Yii::$app->mailchimp->getListMembers($id);

Widget Subscription Example

<?= 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',                        
    ]
]) ?>

Actions

  • 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