ChimpDrill - Merge Tag Parser
, (*1)
Parser for the merge tags syntax of Mailchimp and Mandrill. Supports
placeholder, filters and conditions., (*2)
Installation
Download ChimpDrill by using composer:, (*3)
``` bash
php composer.phar require florian-koerner/chimpdrill:dev-master, (*4)
Or add the code below to your `composer.json`:
``` json
{
"require": {
"florian-koerner/chimpdrill": "dev-master"
}
}
Usage
``` php
$chimpdrill = new \FlorianKoerner\ChimpDrill\ChimpDrill($message, $placeholder);, (*5)
var_dump((string) $chimpdrill);
// or
var_dump($chimpdrill->getParsed());, (*6)
## Example
**Message:**
``` html
Hi *|NAME|*
*|IF:CUSTOMER|*
We want your money!
*|ELSE:|*
We wish you all the best.
*|END:IF|*
, (*7)
*|IF:INVOICE_COUNT == 0|*
All invoices payed. You are the best!
*|ELSEIF:INVOICE_COUNT
, (*8)
- The current year is: *|DATE:Y|*
- Current weather: *|UPPER:WEATHER|*
- Best movie ever: *|TITLE:MOVIE|*
Parameters:
``` php
array(
'NAME' => 'John Doe',
'CUSTOMER' => true,
'INVOICE_COUNT' => 18,
'WEATHER' => 'rainy',
'MOVIE' => 'The last song'
), (*9)
**Result:**
``` html
Hi John Doe
We want your money!
, (*10)
Are you kidding?
, (*11)
- The current year is: 2014
- Current weather: RAINY
- Best movie ever: The Last Song
I Love Open Source
, (*12)