ZF2 MailChimp Module
- Install the PgMailchimp ZF2 module
by cloning it into
./vendor/
. - Clone this project into your
./vendor/
directory.
-
Add this project in your composer.json:
"require": { "earlhickey/pg-mailchimp": "1.*" }
-
Now tell composer to download PgMailchimp by running the command:
$ php composer.phar update
-
Enabling it in your
application.config.php
file.<?php return array( 'modules' => array( // ... 'PgMailchimp', ), // ... );
-
Copy
./vendor/earlhickey/PgMailchimp/config/pg-mailchimp.global.php.dist
to./config/autoload/pg-mailchimp.global.php
and change the values as desired.
-
Subscribe
// create recipient $recipient = new \stdClass(); $recipient->firstname = 'John'; $recipient->lastname = 'Doe'; $recipient->gender = ''; $recipient->dateOfBirth = ''; $recipient->email = '[email protected]'; $subscribe = $this->mailchimp()->subscribe($recipient);
-
Unsubscribe
// create recipient $recipient = new \stdClass(); $recipient->email = '[email protected]'; $unsubscribe = $this->mailchimp()->unsubscribe($recipient);