Skip to content

[UNMAINTAINED] CakePHP datasource for connecting to the Mailchimp API

Notifications You must be signed in to change notification settings

Springest/CakePHP-Mailchimp-datasource

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

This project is no longer maintained.

If you're interested in taking it over, we'd love to hear from you. Email [email protected], or check out one of its maintained forks.


Cakephp Datasource for Mailchimp

With this datasource you can easily add users to your Mailchimp newsletter. It works in both CakePHP 1.2+ and CakePHP 2.0+, but be sure to check out the right branch. The master branch is the active branch which supports CakePHP 2.0 onwards. For older CakePHP versions, please check out the cake-1.3 branch (despite the name it should work with CakePHP 1.2 too).

Please check the original blogpost on our devblog for more background information.

Setup

CakePHP 1.2+

Add the model and datasource in their appropriate folders.

  • APP_DIR/models/
  • APP_DIR/models/datasources/

Add the $mailchimp datasource to APP_DIR/config/database.php

var $mailchimp = array(
    'datasource' => 'mailchimp_subscriber',
    'apiKey' => 'YOUR_API_KEY',
    'defaultListId' => 'YOUR_LIST_ID',
    'baseUrl' => 'http://us1.api.mailchimp.com/1.2/' // or another one, depending on the API version you use
);

CakePHP 2.0+

Add the model and datasource in their appropriate folders.

  • APP_DIR/Model/
  • APP_DIR/Model/Datasource/

Add the $mailchimp datasource to APP_DIR/config/database.php

public $mailchimp = array(
	'datasource' => 'MailchimpSubscriberSource',
	'apikey' => 'YOUR_API_KEY',
	'listId' => 'YOUR_LIST_ID',
	'baseUrl' => 'http://us1.api.mailchimp.com/1.2/' // or another one, depending on the API version you use
);

Usage

When you've set the datasource up correctly, you will now be able to do stuff like $this->MailchimpSubscriber->save($this->data), or call other regular Model methods (like Model::find) from any controller that uses the MailchimpSubscriber model.

About

[UNMAINTAINED] CakePHP datasource for connecting to the Mailchimp API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages