Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

lyrixx/Email-Makr

Repository files navigation

Email-Makr

With Email-Makr you design only one twig template and a csv with translated block. Then Email-Makr will generate all variants for your email.

Email-Makr takes as first argument a path to a twig template. It could be any valid twig template. For exemple:

<li>lang : {{ lang }}</li>
<li>var1 : {{ var1 }}</li>
<li>var1 : {{ var2 }}</li>

Email-Makr takes as second argument a path to a csv file. The csv file should contains a least :

  • One header row, with variable name. Theses variable names will be uses in twig template
  • Many row, with in the first column the target language. For exemple:
var1 var2
en value en 1 value en 2
fr value fr 1 value fr 2

See exemple for more information.

Usage

emailmakr template.html.twig datas.csv

Options:

  • --output-directory, default: ./emailings/
  • --output-format, default: "mail_LANG.html. LANG is a placeholder. It will be remplaced by the current language

Ouput looks for:

$ ./emailmakr.php generate-email index.html.twig datas.csv
Generated "/var/www/dev/sensio/emailings/exemple/emailings/mail_fr.html"
Generated "/var/www/dev/sensio/emailings/exemple/emailings/mail_en.html"
Generated "/var/www/dev/sensio/emailings/exemple/emailings/mail_es.html"
Generated "/var/www/dev/sensio/emailings/exemple/emailings/mail_it.html"
Finished

Installation

Use it as a single file:

Downlaod email-makr and run it: php email-makr.

With Composer:

composer create-project lyrixx/email-makr email-makr

About

Generate emailings with twig and csv

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages