PHPackages                             colq2/blade-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. colq2/blade-mjml

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

colq2/blade-mjml
================

Mjml for Blade.

v3.0.0(1mo ago)6925[8 PRs](https://github.com/colq2/blade-mjml/pulls)MITPHPPHP ^8.2CI passing

Since Jul 10Pushed 1w ago1 watchersCompare

[ Source](https://github.com/colq2/blade-mjml)[ Packagist](https://packagist.org/packages/colq2/blade-mjml)[ Docs](https://github.com/colq2/blade-mjml)[ GitHub Sponsors](https://github.com/colq2)[ RSS](/packages/colq2-blade-mjml/feed)WikiDiscussions main Synced yesterday

READMEChangelog (1)Dependencies (31)Versions (17)Used By (0)

Blade Mjml
==========

[](#blade-mjml)

[![Latest Version on Packagist](https://camo.githubusercontent.com/56c8bbbc40db57a3d1684c55d6fc312c2da9544f5fcea179f192fccab1ef48ab/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f6c71322f626c6164652d6d6a6d6c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/colq2/blade-mjml)[![GitHub Tests Action Status](https://camo.githubusercontent.com/1bbc1398db9b63ed036a78927848e0a623083e98ed4a8656418b2049d022af58/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f636f6c71322f626c6164652d6d6a6d6c2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/colq2/blade-mjml/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/922d03eae246a769d95430e5ea8c809ee43c4ff6b4af097b11e15ae76edfe08c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f636f6c71322f626c6164652d6d6a6d6c2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/colq2/blade-mjml/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/f184f5aee303c1d15a96a79688f0d371b4fd68be6cacf02b5b135e2cb1357c7b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f6c71322f626c6164652d6d6a6d6c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/colq2/blade-mjml)

This package is a port of [mjml](https://mjml.io/) to laravel blade. The goal is to have a running mjml version purely in php and blade, without the need for node.

To compile mjml templates, place you mjml templates into `mjml.blade.php` files.

Then you use the original mjml xml:

```

                Hello World

```

You can now use this view in your mails:

```
public function content(): Content
{
    return new Content(
        view: 'mail.mjml-example',
    );
}
```

Limitations
-----------

[](#limitations)

- mj-include is not supported. Use `@include` instead.
- mj-html-attributes not supported yet.
- mj-raw attribute `position="file-start"` is not supported yet.
- Inline mj-style not working yet.
- mj-accordion does not handle missing children. You need to always provide mj-accordion-text and mj-accordion-title.

Component overview
------------------

[](#component-overview)

Head Components:

- mj-attributes
- mj-breakpoint
- mj-font
- mj-html-attributes
- mj-preview
- mj-style
- mj-title

Body Components:

- mj-accordion
- mj-button
- mj-carousel
- mj-column
- mj-divider
- mj-group
- mj-hero
- mj-image
- mj-navbar
- mj-raw
- mj-section
- mj-social
- mj-spacer
- mj-table
- mj-text
- mj-wrapper

Good to know
------------

[](#good-to-know)

The original mjml implementation works differently than the blade compiler. MJML renders recursively, which means that a parent component calls the render function of all its childern and can provide a context or wrap them. The blade compiler works differently. First it compiles the blade view into a php file, then it "just" runs the php file. We cannot provide a context programmatically, because the blade compiler does not know about the context of the parent component.

(Blade do not really know that it is working with html. It does not care, it does not do any html analysis or anything like that. It is just string manipulation.)

This is the biggest challenge of this package. This is why we keep a context stack and a global context.

For example, we need to wrap the child components of a column into a table, which in mjml is done in the mj-column component.

Another challenge was to find out how many siblings a colum has. In the component we don't have any access to the parent html or whatsoever. Now this package "precompiles" the mjml and sets the siblings as an attribute.

The precompilation also changes &lt;mj-*&gt; tp &lt;x-mj-*&gt; so that the blade compiler can handle it correctly.

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

[](#installation)

Install the package via composer:

```
composer require colq2/blade-mjml
```

Usage
-----

[](#usage)

Just put mjml template into your blade files and use the view for sending emails.

Relevant documentation for laravel and mjml:

- [Sending Emails in Laravel](https://laravel.com/docs/12.x/mail#configuring-the-view)
- [MJML Documentation](https://mjml.io/documentation/)

```
// resources/views/mail/mjml-example.mjml.blade.php

                Hello World

```

And use the view in your mail class:

```
public function content(): Content
{
    return new Content(
        view: 'mail.mjml-example',
    );
}
```

Or render it directly as a view:

```
Route::get('/mjml-example', function () {
    return view('mail.mjml-example');
});
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [colq2](https://github.com/colq2)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance95

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.7% 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 ~157 days

Total

3

Last Release

44d ago

Major Versions

v1.0.0 → v2.0.02025-08-01

v2.0.0 → v3.0.02026-05-20

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/25695283?v=4)[Oliver Wycisk](/maintainers/colq2)[@colq2](https://github.com/colq2)

---

Top Contributors

[![colq2](https://avatars.githubusercontent.com/u/25695283?v=4)](https://github.com/colq2 "colq2 (55 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (2 commits)")

---

Tags

bladelaravellaravelblademjmlcolq2

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/colq2-blade-mjml/health.svg)

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

###  Alternatives

[moonshine/moonshine

Laravel administration panel

1.3k253.1k81](/packages/moonshine-moonshine)[blade-ui-kit/blade-icons

A package to easily make use of icons in your Laravel Blade views.

2.5k42.5M404](/packages/blade-ui-kit-blade-icons)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M345](/packages/psalm-plugin-laravel)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45444.2k1](/packages/pressbooks-pressbooks)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)

PHPackages © 2026

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