PHPackages                             qferr/mjml-twig - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. qferr/mjml-twig

ActiveLibrary[Templating &amp; Views](/categories/templating)

qferr/mjml-twig
===============

Twig extension that provides a filter that processes a mjml email template

2.0.1(3y ago)20378.7k↓10.8%5[2 PRs](https://github.com/qferr/mjml-twig/pulls)1PHPPHP &gt;=7.2CI failing

Since Apr 2Pushed 3y ago1 watchersCompare

[ Source](https://github.com/qferr/mjml-twig)[ Packagist](https://packagist.org/packages/qferr/mjml-twig)[ RSS](/packages/qferr-mjml-twig/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (3)Versions (9)Used By (1)

Twig MJML extension
===================

[](#twig-mjml-extension)

This package is a Twig extension that provides the following:

- mjml\_to\_html filter: processes a mjml email template.

```
{% apply mjml_to_html %}

                Hello {{ username }}

{% endapply %}
```

Because we have two ways for rendering MJML to HML, the extension depends on a renderer:

- **BinaryRenderer**: using the MJML library. You will have to provide the location of the MJML binary. Don’t forget to install it with the Node package manager.
- **ApiRenderer**: using the MJML API. Nothing to install. You will have to provide the credentials to access of the API.

Thanks to the library [MJML in PHP](https://github.com/qferr/mjml-php) for make easier the integration of MJML in PHP. Read the article [Rendering MJML in PHP](https://medium.com/@qferrer/rendering-mjml-in-php-982d703aa703?source=friends_link&sk=7c5553ae7fcfcdde889bdd3b776c90a9) for more informations.

Installation
------------

[](#installation)

`composer require qferr/mjml-twig`

Usage
-----

[](#usage)

```
