定制 florian-koerner/chimpdrill 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

florian-koerner/chimpdrill

最新稳定版本:v1.2.0

Composer 安装命令:

composer require florian-koerner/chimpdrill

包简介

Simple Mailchimp / Mandrill Merge Tags Parser

README 文档

README

Build Status Scrutinizer Code Quality Coverage Status SensioLabsInsight

Parser for the merge tags syntax of Mailchimp and Mandrill. Supports placeholder, filters and conditions.

Installation

Download ChimpDrill by using composer:

php composer.phar require florian-koerner/chimpdrill:dev-master

Or add the code below to your composer.json:

{
    "require": {
        "florian-koerner/chimpdrill": "dev-master"
    }
}

Usage

$chimpdrill = new \FlorianKoerner\ChimpDrill\ChimpDrill($message, $placeholder);

var_dump((string) $chimpdrill);
// or
var_dump($chimpdrill->getParsed());

Example

Message:

<h1>Hi *|NAME|*</h1>

<p>
    *|IF:CUSTOMER|*
        We want your money!
    *|ELSE:|*
        We wish you all the best.
    *|END:IF|*
</p>

<p>
    *|IF:INVOICE_COUNT == 0|*
        All invoices payed. You are the best!
    *|ELSEIF:INVOICE_COUNT <= 5|*
        Oops... You have open invoices.
    *|ELSE:|*
        Are you kidding?
    *|END:IF|*
</p>

<ul>
    <li>The current year is: *|DATE:Y|*</li>
    <li>Current weather: *|UPPER:WEATHER|*</li>
    <li>Best movie ever: *|TITLE:MOVIE|*</li>
</ul>

Parameters:

array(
    'NAME' => 'John Doe',
    'CUSTOMER' => true,
    'INVOICE_COUNT' => 18,
    'WEATHER' => 'rainy',
    'MOVIE' => 'The last song'
)

Result:

<h1>Hi John Doe</h1>

<p>
    We want your money!
</p>

<p>
    Are you kidding?
</p>

<ul>
    <li>The current year is: 2014</li>
    <li>Current weather: RAINY</li>
    <li>Best movie ever: The Last Song</li>
</ul>

I Love Open Source

I Love Open Source

统计信息

  • 总下载量: 30.29k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 1
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: CC0-1.0
  • 更新时间: 2014-09-19