PHPackages                             surda/mjml-nette - 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. surda/mjml-nette

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

surda/mjml-nette
================

MJML integration into Nette Framework

v1.1.0(6y ago)05MITPHPPHP &gt;=7.1CI failing

Since Nov 7Pushed 6y ago1 watchersCompare

[ Source](https://github.com/surda/mjml-nette)[ Packagist](https://packagist.org/packages/surda/mjml-nette)[ Docs](http://surani.cz)[ RSS](/packages/surda-mjml-nette/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (12)Versions (3)Used By (0)

[MJML](https://github.com/mjmlio/mjml) integration into Nette Framework.
========================================================================

[](#mjml-integration-into-nette-framework)

[![Build Status](https://camo.githubusercontent.com/fe822105d697ede308200c36c389f6d84e884994a5f1f14e617ca815f5cdba7f/68747470733a2f2f7472617669732d63692e6f72672f73757264612f6d6a6d6c2d6e657474652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/surda/mjml-nette)[![Licence](https://camo.githubusercontent.com/d3d3805bb79a8fdb1cfac8acb5b33d1be4c4b601229f97ee3d3f42cbf914ac23/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f73757264612f6d6a6d6c2d6e657474652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/surda/mjml-nette)[![Latest stable](https://camo.githubusercontent.com/7187eb4766b9506792f69c0a6281b2f0c5aa1a2a9097ae0abfcf8639c8e91713/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73757264612f6d6a6d6c2d6e657474652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/surda/mjml-nette)[![PHPStan](https://camo.githubusercontent.com/441b5874ce4df0a2defc892979c96c46889b69cb32119d04f0b48626349f8bc9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d656e61626c65642d627269676874677265656e2e7376673f7374796c653d666c6174)](https://github.com/phpstan/phpstan)

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

[](#installation)

The recommended way to is via Composer:

```
composer require surda/mjml-nette

```

After that you have to register extensions in config.neon:

### Binary renderer

[](#binary-renderer)

```
extensions:
    mjml: Surda\Mjml\DI\MjmlExtension
    mjml.renderer: Surda\Mjml\DI\MjmlBinaryRendererExtension
```

List of all configuration options:

```
mjml:
    debug: %debugMode%
    tempDir: %tempDir%/cache/latte
    templateFactory: \Surda\Mjml\TemplateFactory

mjml.renderer:
    renderer: \Surda\Mjml\Renderer\BinaryRenderer
    options:
        bin: mjml
        minify: FALSE
        validationLevel: strict
        beautify: TRUE
```

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

```
$ npm install -g mjml
```

### API renderer

[](#api-renderer)

```
extensions:
    mjml: Surda\Mjml\DI\MjmlExtension
    mjml.renderer: Surda\Mjml\DI\MjmlApiRendererExtension
```

Minimal configuration:

```
mjml.renderer:
    options:
        applicationId: 'application-id'
        secretKey: 'secret-key'
```

List of all configuration options:

```
mjml:
    debug: %debugMode%
    tempDir: %tempDir%/cache/latte
    templateFactory: \Surda\Mjml\TemplateFactory

mjml.renderer:
    renderer: \Surda\Mjml\Renderer\ApiRenderer
    options:
        applicationId: 'application-id'
        secretKey: 'secret-key'
        uri: 'https://api.mjml.io/v1/render'
```

Usage
-----

[](#usage)

Template `template.mjml`

```

                Hello {$foo}

```

```
use Surda\Mjml\MjmlTemplateFactory;

class MailSender
{
    /** @var MjmlTemplateFactory */
    private $mjmlTemplateFactory;

    /**
     * @param MjmlTemplateFactory $mjmlTemplateFactory
     */
    public function __construct(MjmlTemplateFactory $mjmlTemplateFactory)
    {
        $this->mjmlTemplateFactory = $mjmlTemplateFactory;
    }

    public function sendEmail(): void
    {
        $template = $this->mjmlTemplateFactory->create();
        $template->setFile('/path/to/template.mjml');
        $template->setParameters(['foo' => 'World']);

        $mail = new Message;
        $mail->setHtmlBody($template);

        // or

        $template = $this->mjmlTemplateFactory->create();

        $mail = new Message;
        $mail->setHtmlBody($template->renderToString('/path/to/template.mjml', ['foo' => 'World'])));

        // ...
    }
}
```

Mail

[![mail](https://raw.githubusercontent.com/surda/mjml-nette/master/doc/mail.png)](https://raw.githubusercontent.com/surda/mjml-nette/master/doc/mail.png)

Others
------

[](#others)

Only render \*.latte template from \*.mjml template

```
use Surda\Mjml\Engine;

class Convertor
{
    /** @var Engine */
    private $engine;

    /**
     * @param Engine $engine
     */
    public function __construct(Engine $engine)
    {
        $this->engine = $engine;
    }

    public function convert(): void
    {
        $mjmlFile = '/path/to/template.mjml';
        $latteFile = $this->engine->renderLatteFile($mjmlFile);

        // or

        $mjmlFile = '/path/to/template.mjml';
        $latteFile = '/path/to/template.latte';
        $this->engine->renderLatteFile($mjmlFile, $latteFile);
    }
}
```

---

More in the [MJML documentation](https://mjml.io/documentation/).

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~1 days

Total

2

Last Release

2372d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e8d497ef90ca9ed180419b5ab29857be10e88d0614cf01c94b0f2ab5094de45d?d=identicon)[surda](/maintainers/surda)

---

Top Contributors

[![surda](https://avatars.githubusercontent.com/u/588663?v=4)](https://github.com/surda "surda (3 commits)")

---

Tags

nettemailmjml

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/surda-mjml-nette/health.svg)

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

###  Alternatives

[nette/mail

📧 Nette Mail: A handy library for creating and sending emails in PHP.

5389.8M244](/packages/nette-mail)[contributte/mailing

Sending emails with pleasure and prepared templates.

16961.0k2](/packages/contributte-mailing)[notfloran/mjml-bundle

Symfony bundle for MJML

1142.1M2](/packages/notfloran-mjml-bundle)[vemcogroup/laravel-sparkpost-driver

SparkPost driver to use with Laravel 6.x|7.x|8.x|9.x|10.x

421.7M1](/packages/vemcogroup-laravel-sparkpost-driver)

PHPackages © 2026

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