PHPackages                             discutea/mjml-bundle - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. discutea/mjml-bundle

ActiveSymfony-bundle[Mail &amp; Notifications](/categories/mail)

discutea/mjml-bundle
====================

Symfony bundle for MJML

v3.2.0(6y ago)011MITPHP ^7.1.0

Since Nov 7Pushed 6y agoCompare

[ Source](https://github.com/DavidVerdier/mjml-bundle)[ Packagist](https://packagist.org/packages/discutea/mjml-bundle)[ RSS](/packages/discutea-mjml-bundle/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (7)Versions (14)Used By (0)

MjmlBundle
==========

[](#mjmlbundle)

[![Latest Stable Version](https://camo.githubusercontent.com/6c10e4fdd718d1590eae7c4d2c3a3c90b617e62e9d68cf643b73d7444732f619/68747470733a2f2f706f7365722e707567782e6f72672f6e6f74666c6f72616e2f6d6a6d6c2d62756e646c652f762f737461626c652e737667)](https://packagist.org/packages/notfloran/mjml-bundle)[![Latest Unstable Version](https://camo.githubusercontent.com/5937e0855e9df00896a6bf5a946809f2849089edfcce885cda43f808f0693493/68747470733a2f2f706f7365722e707567782e6f72672f6e6f74666c6f72616e2f6d6a6d6c2d62756e646c652f762f756e737461626c652e737667)](https://packagist.org/packages/notfloran/mjml-bundle)

Bundle to use [MJML](https://mjml.io/) 3 and 4 with Symfony &gt;= 3.

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

[](#installation)

### Applications that use Symfony Flex

[](#applications-that-use-symfony-flex)

Open a command console, enter your project directory and execute:

```
$ composer require notfloran/mjml-bundle
```

### Applications that don't use Symfony Flex

[](#applications-that-dont-use-symfony-flex)

#### Step 1: Download the Bundle

[](#step-1-download-the-bundle)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
$ composer require notfloran/mjml-bundle
```

This command requires you to have Composer installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.

#### Step 2: Enable the Bundle

[](#step-2-enable-the-bundle)

Then, enable the bundle by adding it to the list of registered bundles in the `app/AppKernel.php` file of your project:

```
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            // ...
            new NotFloran\MjmlBundle\MjmlBundle(),
        ];

        // ...
    }

    // ...
}
```

Renderer
--------

[](#renderer)

For the moment only one renderer is available, the binary renderer.

### Binary

[](#binary)

Install [MJML](https://mjml.io)

```
$ npm install mjml
```

Then you need to update the configuration:

```
# config/packages/mjml.yaml
mjml:
  renderer: binary # default: binary
  options:
    binary: '%kernel.project_dir%/node_modules/.bin/mjml' # default: mjml
    minify: true # default: false
    validation_level: skip # default: strict. See https://mjml.io/documentation/#validating-mjml
```

### Custom

[](#custom)

First you must create a class which implements `NotFloran\MjmlBundle\Renderer\RendererInterface`, then declare it as a service.

And finally you have to change the configuration:

```
# config/packages/mjml.yaml
mjml:
    renderer: 'service'
    options:
        service_id: 'App\Mjml\MyCustomRenderer'
```

### API

[](#api)

The bundle has no official integration with the [MJML API](https://mjml.io/api).

You can create your own integration by using [juanmiguelbesada/mjml-php](https://packagist.org/packages/juanmiguelbesada/mjml-php) and following this gist : .

Usage
-----

[](#usage)

### Use "mjml" service

[](#use-mjml-service)

```
{# templates/mail/example.mjml.twig #}

                        Hello {{ name }} from MJML and Symfony

```

```
$message = (new \Swift_Message('Hello Email'))
    ->setFrom('my-app@example.fr')
    ->setTo('me@example.fr')
    ->setBody(
        $this->get('mjml')->render(
            $this->get('twig')->render('templates/mail/example.mjml.twig', [
                'name' => 'Floran'
            ])
        ),
        'text/html'
    )
;

$this->get('mailer')->send($message);
```

### Use "mjml" twig tag

[](#use-mjml-twig-tag)

```
{# mail/example.mjml.twig #}
{% block email_content %}
    {% mjml %}

                            Hello {{ name }} from MJML and Symfony

    {% endmjml %}
{% endblock %}
```

```
$message = (new \Swift_Message('Hello Email'))
    ->setFrom('my-app@example.fr')
    ->setTo('me@example.fr')
    ->setBody(
        $this->get('twig')->render('templates/mail/example.mjml.twig', [
            'name' => 'Floran'
        ]),
        'text/html'
    )
;

$this->get('mailer')->send($message);
```

SwiftMailer integration
-----------------------

[](#swiftmailer-integration)

Declare the following service:

```
NotFloran\MjmlBundle\SwiftMailer\MjmlPlugin:
    tags: [swiftmailer.default.plugin]
```

Create a SwiftMailer message with a MJML body (without `{% mjml %}`) and with `text/mjml` as content-type:

```
$message = (new \Swift_Message('Hello Email'))
    ->setFrom('send@example.com')
    ->setTo('recipient@example.com')
    ->setBody(
        $this->renderView('mail/example.mjml.twig'),
        'text/mjml'
    )

$mailer->send($message);
```

The plugin will automatically render the MJML body and replace the body with the rendered HTML.

In the case where a spool is used: the MJML content is save in the spool and render when the spool is flushed.

License
-------

[](#license)

[MjmlBundle](https://github.com/notFloran/mjml-bundle) is licensed under the [MIT license](LICENSE).

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 95% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~63 days

Recently: every ~45 days

Total

12

Last Release

2411d ago

Major Versions

v1.0.0 → v2.0.02018-03-13

v2.1.2 → v3.0.02018-11-18

### Community

Maintainers

![](https://www.gravatar.com/avatar/1665749a14762d0c0425612234403ea8c64c9c7f79a7484ef7be72bda7ab54e3?d=identicon)[Strategy](/maintainers/Strategy)

---

Top Contributors

[![notFloran](https://avatars.githubusercontent.com/u/523981?v=4)](https://github.com/notFloran "notFloran (96 commits)")[![RichAtPowderBlue](https://avatars.githubusercontent.com/u/47561048?v=4)](https://github.com/RichAtPowderBlue "RichAtPowderBlue (2 commits)")[![danchukas](https://avatars.githubusercontent.com/u/26610006?v=4)](https://github.com/danchukas "danchukas (1 commits)")[![matthieumota](https://avatars.githubusercontent.com/u/2427947?v=4)](https://github.com/matthieumota "matthieumota (1 commits)")[![mxr576](https://avatars.githubusercontent.com/u/1755573?v=4)](https://github.com/mxr576 "mxr576 (1 commits)")

---

Tags

emailmjml

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/discutea-mjml-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/discutea-mjml-bundle/health.svg)](https://phpackages.com/packages/discutea-mjml-bundle)
```

###  Alternatives

[notfloran/mjml-bundle

Symfony bundle for MJML

1142.1M2](/packages/notfloran-mjml-bundle)[sylius/mailer-bundle

Mailers and e-mail template management for Symfony projects.

728.1M77](/packages/sylius-mailer-bundle)[phplist/core

The core module of phpList, the world's most popular open source newsletter manager

885.2k3](/packages/phplist-core)[stampie/stampie-bundle

This bundle provides integration for Stampie Email Library

25222.1k](/packages/stampie-stampie-bundle)[azine/mailgunwebhooks-bundle

Symfony2 Bundle to easily capture feedback from mailgun.com via their provided webhooks

104.1k](/packages/azine-mailgunwebhooks-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
