PHPackages                             rennokki/laravel-mjml - 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. rennokki/laravel-mjml

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

rennokki/laravel-mjml
=====================

Laravel MJML offers support for rendering MJML syntax into in-line HTML that can be sent within mails.

1.0.0(7y ago)2517.5k3MITPHP

Since Aug 5Pushed 6y agoCompare

[ Source](https://github.com/rennokki/laravel-mjml)[ Packagist](https://packagist.org/packages/rennokki/laravel-mjml)[ Docs](https://github.com/rennokki/laravel-mjml)[ RSS](/packages/rennokki-laravel-mjml/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (5)Versions (3)Used By (0)

[![Build Status](https://camo.githubusercontent.com/8725a8e779aad0373ce70d9bd8dea2f3eb9ef4c75696a6b5976bf07a531dc000/68747470733a2f2f7472617669732d63692e6f72672f72656e6e6f6b6b692f6c61726176656c2d6d6a6d6c2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/rennokki/laravel-mjml)[![codecov](https://camo.githubusercontent.com/1b6c016b9c6f4a3ec3d5fef172fce1cf1ecc7109848682baf814a015ad41481a/68747470733a2f2f636f6465636f762e696f2f67682f72656e6e6f6b6b692f6c61726176656c2d6d6a6d6c2f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/rennokki/laravel-mjml/branch/master)[![StyleCI](https://camo.githubusercontent.com/bc108e0339e52f7a0f5a35e1319047531a077d1977e2bcdccc6b4be8d8fcc11f/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3134333630313233382f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/143601238)[![Latest Stable Version](https://camo.githubusercontent.com/dfc0083bf2129dbe8f0b1f408e5b551571dd8744b3b4fd0ad4f76ca6d1515e96/68747470733a2f2f706f7365722e707567782e6f72672f72656e6e6f6b6b692f6c61726176656c2d6d6a6d6c2f762f737461626c65)](https://packagist.org/packages/rennokki/laravel-mjml)[![Total Downloads](https://camo.githubusercontent.com/0a6feff834cd1618efa8d8f8356fc3b1f108013876dbbfadda685c853a3d9079/68747470733a2f2f706f7365722e707567782e6f72672f72656e6e6f6b6b692f6c61726176656c2d6d6a6d6c2f646f776e6c6f616473)](https://packagist.org/packages/rennokki/laravel-mjml)[![Monthly Downloads](https://camo.githubusercontent.com/7a82b7f5b6099a86037de6f62b4b9a50c70390afaed3832af47138cc2c132efe/68747470733a2f2f706f7365722e707567782e6f72672f72656e6e6f6b6b692f6c61726176656c2d6d6a6d6c2f642f6d6f6e74686c79)](https://packagist.org/packages/rennokki/laravel-mjml)[![License](https://camo.githubusercontent.com/aa17cebd74c3c08459468cf0bd56c24b0954f19eff43fe36b66c135b25672ace/68747470733a2f2f706f7365722e707567782e6f72672f72656e6e6f6b6b692f6c61726176656c2d6d6a6d6c2f6c6963656e7365)](https://packagist.org/packages/rennokki/laravel-mjml)

[![PayPal](https://camo.githubusercontent.com/e3d021da65162fda975bd58ef4a4d80bdd03d6e94aa1b321d179e6b4c1aff357/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f50617950616c2d646f6e6174652d626c75652e737667)](https://paypal.me/rennokki)

Laravel MJML
============

[](#laravel-mjml)

Laravel MJML is a simple API wrapper for the [MJML.io Render API](https://mjml.io/api). In case you don't know what [MJML.io](https://mjml.io) is, it is a language that helps building mails easier and faster without messing up with inline HTML. It has its own syntax that can be later rendered using their apps, online editor or their API.

This API wrapper comes with Mustache Engine integrated, so you can both render the MJML to HTML with applied values from Mustache.

If you don't know what Mustache is check [this Medium article](https://medium.com/@alexrenoki/dynamic-content-in-your-mails-using-mustache-9f3a660462ad) that explains better Mustahce and gets you started on how to use it in your email.

Installation
============

[](#installation)

Install the package:

```
$ composer require rennokki/laravel-mjml
```

If your Laravel version does not support package discovery, add this line in the `providers` array in your `config/app.php` file:

```
Rennokki\LaravelMJML\LaravelMJMLServiceProvider::class,
```

Setting up the API
==================

[](#setting-up-the-api)

Since it is an API, you'll need credentials. For this, you will have to request yours from their API page:  by clicking `Join the beta`. It will take some time to get yours, so be patient.

To authenticate the API, you will have to call the `Rennokki\LaravelMJML\LaravelMJML` class and then, by chaining methods, to add your `App ID` and your `Secret Key`.

```
use Rennokki\LaravelMJML\LaravelMJML;

$api = (new LaravelMJML())->setAppId('app_id')->setSecretKey('secret_key');
```

Note: when making requests from the backend, just the `Secret Key` is required. If you plan to do it from the frontend, you will have to use your provided `Public Key` instead, since storing sensitive credentials in frontend is not possible.

Starting MJML
=============

[](#starting-mjml)

As MJML code, we'll use this throughout the readme:

```

            Hello World

```

Rendering
=========

[](#rendering)

When rendering, simply calling the `render()` method will do the work for you:

```
$html = $api->render($mjml);
```

As a return, you will get the compiled HTML. In case this rendering failed, due to reasons, you will get `null`, for example:

```
$html = $api->render('MJML'); // null
```

Rendering with Mustache
=======================

[](#rendering-with-mustache)

If you got started with Mustache, you can render the MJML to HTML and then render the Mustache variables in your compiled HTML using the same method.

For this example, our MJML would look like this:

```

            {{message}}

```

You can call `renderWithMustache` method with MJML and an array which consist the parameters that need to injected:

```
$html = $api->renderWithMustache($mjml, ['message' => 'Hello World!']);
```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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

Unknown

Total

1

Last Release

2838d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/21983456?v=4)[rennokki](/maintainers/rennokki)[@rennokki](https://github.com/rennokki)

---

Top Contributors

[![rennokki](https://avatars.githubusercontent.com/u/21983456?v=4)](https://github.com/rennokki "rennokki (5 commits)")

---

Tags

apicontentemaillaravelmailmailingmailsmjmlmjmliomustachephprendertemplatetemplateswrapperapilaravelmailemailtemplatewrappertemplatesemailsmjmlmailsmjmlio

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rennokki-laravel-mjml/health.svg)

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

###  Alternatives

[larablocks/pigeon

A more flexible email message builder for Laravel 5 including chained methods, reusable message configurations, and message layout and template view management.

143.7k](/packages/larablocks-pigeon)[wrklst/docxmustache

docx template manipulation class, based on mustache templating language

578.1k](/packages/wrklst-docxmustache)[dansmaculotte/laravel-mail-template

A mail template driver to send emails with

353.0k](/packages/dansmaculotte-laravel-mail-template)[muratbsts/mail-template

This package is a easy to use mail template collection for Laravel 5.x.

191.3k](/packages/muratbsts-mail-template)

PHPackages © 2026

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