Cethy / TwigSwiftMessage

[NOT MAINTAINED] Build Swift_Messages with twig and optionally inline the css with CssToInlineStyles.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cethyworks/TwigSwiftMessage

Build Swift_Messages with twig and optionally inline the css with CssToInlineStyles.

CircleCI

Install

1. Composer require

$ composer require cethyworks/twig-swift-message

How to use

1. Create your twig template using the 3 blocks subject, body_html and/or body_txt (all blocks are optional).

{% block subject %}subject{% endblock subject %}

{% block style %}.baz {color:red;}{% endblock style %}

{% block body_html %}
    {{ foo }}<br>
    <p class="baz">bar</p>
{% endblock body_html %}

{% block body_txt %}
    {{ foo }}
    bar
{% endblock body_txt %}

2. Call TwigSwiftMessageBuilder::buildMessage()

/** @var Swift_Message $swiftMessage */
$swiftMessage = $messageBuilder->buildMessage($templateName, $templateParameters);

3. Add your recipient(s). And sent it !

About

[NOT MAINTAINED] Build Swift_Messages with twig and optionally inline the css with CssToInlineStyles.


Languages

Language:PHP 90.4%Language:HTML 9.6%