Skip to content

Yii2 MailChimp extension to manage Mailchimp Email Marketing Platform https://www.mailchimp.com/

Notifications You must be signed in to change notification settings

cinghie/yii2-mailchimp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yii2 Mailchimp

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

About

Yii2 MailChimp extension to manage Mailchimp Email Marketing Platform https://www.mailchimp.com/

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages