The plugin is available at Github as CakePHP-YMLP-Plugin.
CakePHP YMLP Component
YMLP, or Your Mailing List Provider, is a email newsletter and marketing service with free and paid accounts, and a well written API.
This component interfaces a CakePHP app with YMLP’s API.
You will need a free or paid account at YMLP, along with your username and API key (found at ymlp.com under “Configuration”, “API”). Make sure to enable API access on YMLP’s API page!
Compatibility:
Tested with CakePHP 2.3.x. Requires PHP 5 with cURL support.
Installation:
In your project composer.json
file:
1 2 3 4 5 |
|
Using git:
1
|
|
Configuration:
All configuration is in APP/Config/bootstrap.php.
Required: Load the plugin:
1
|
|
or
1
|
|
Required: Set your YMLP API key and username.
1 2 3 4 5 |
|
Required: Set your YMLP field mapping, which is your local field => YMLPField.
1 2 3 4 |
|
Usage:
Add the component to your controller:
1 2 |
|
Example: if you have a subscriber form with a field named email
, $this->request->data
would look
something like this:
1 2 3 |
|
To add this email address to YMLP using the component:
1 2 |
|
The $result
would be the response from YMLP’s Contacts.Add()
method. See the YMLP docs for all
available API commands.
The available methods of this component are:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|
Example usage of the utility
method to view a list of configured YMLP fields. If you created
a form at YMLP to collect name, email address, and mailing address, you need to match your app’s
fields with YMLP fields. The YMLP API Fields.GetList()
method can give you what you need.
Create a temporary method in your controller and use the component’s utility
method:
1 2 3 4 5 6 |
|
Visit /utility and you should see a list of YMLP configured fields with field id, which you can use
to map to your app fields with the Ymlp.fieldMap
configuration array.
1 2 3 4 5 6 7 8 9 10 |
|