egangloff / yii2-mailchimp
Yii2 Component for Mailchimp Api V3
dev-master
2019-06-25 07:20 UTC
Requires
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2025-03-25 20:48:00 UTC
README
Yii2 Component for Mailchimp Api V3 using Curl
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist linslin/yii2-curl "*"
php composer.phar require --prefer-dist egangloff/yii2-mailchimp "dev-master"
or add
"linslin/yii2-curl": "*",
"egangloff/yii2-mailchimp": "dev-master"
to the require section of your composer.json
file.
Configuration
Setup component in config/main.php
'components' => [
'mailchimp' => [
'class' => Mailchimp::class,
'apikey' => 'Your_Mailchimp_Api-Key'
],
]
Use
In your controller,
use egangloff\mailchimp\mailchimp;
$mailchimp = new Mailchimp;
Methods
Get all lists
$mailchimp->getLists();
Get A specific list
$mailchimp->getLists('<listid>')
Get all members from a list
$mailchimp->getMembers('<listid>')
Get a specific member from a list
$mailchimp->getLists('<listid>', '<memberid>')
Add a Member to a list
$mailchimp->addMember('<listid>', <firstname>', '<lastname>', '<email>', '<phone>')
Delete a member from a list
$mailchimp->deleteMember('<listid>', '<memberid>')
Error Management
echo 'Status Code: ' . $mailchimp->statuscode . ' - Status Message: ' . $mailchimp->statustext;