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
Requires
- php: >=5.6.17
- swiftmailer/swiftmailer: ^5.3|^6.0
- tijsverkoyen/css-to-inline-styles: ^2.2
- twig/twig: ^1.0||^2.0
Requires (Dev)
- phpunit/phpunit: ^4.8
This package is not auto-updated.
Last update: 2024-11-16 16:02:19 UTC
README
Build Swift_Message
s with twig and optionally inline the css with CssToInlineStyles.
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 !