cinghie/yii2-mailchimp

Yii2 Mailchimp to manage Mailchimp Email Platform in a Yii2 site.

Installs: 3 864

Dependents: 0

Suggesters: 0

Security: 0

Stars: 9

Watchers: 4

Forks: 5

Open Issues: 0

Type:yii2-extension

0.2.2 2019-04-15 11:09 UTC

This package is auto-updated.

Last update: 2024-11-08 12:39:35 UTC


README

License Latest Stable Version Latest Release Date Latest Commit Total Downloads

Yii2 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 cinghie/yii2-mailchimp "*"

or add

"cinghie/yii2-mailchimp": "*"

Configuration

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
    ]
    
]

Overrides

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',
			],
		],
	],
	
],

Usage

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

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