cethyworks/twig-swift-message

This package is abandoned and no longer maintained. No replacement package was suggested.

Provides a Swift_Message builder using twig.

v2.0 2017-08-14 23:57 UTC

This package is not auto-updated.

Last update: 2024-11-16 16:02:19 UTC


README

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 !