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

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

daylaborers/laravel-mjml
========================

Use MJML Templates with Laravel Mailables

1.0.1(2y ago)19681MITPHPPHP ^8.2.0

Since Apr 3Pushed 2y ago1 watchersCompare

[ Source](https://github.com/dayLaborers/laravel-mjml)[ Packagist](https://packagist.org/packages/daylaborers/laravel-mjml)[ RSS](/packages/daylaborers-laravel-mjml/feed)WikiDiscussions main Synced 1mo ago

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

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

[](#laravel-mjml)

Build responsive e-mails easily using MJML and Laravel Mailables.

MJML
----

[](#mjml)

MJML is a markup language, from MailJet, that reduces the effort required to develop responsive emails. For more information, have a look at the [documentary](https://documentation.mjml.io/).

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

[](#installation)

To install this package, run this composer command:

`composer require dayLaborers/laravel-mjml`

After composer installs the packages, you can publish the package configuration using artisan command:

`php artisan vendor:publish --tag=mjml-config`

Configuration
-------------

[](#configuration)

There are two options, to render MJML:

- cli: Use the MJML npm package
- api: Use the public [MJML API](https://mjml.io/api)

The desired procedure can be configured via the environment variable `MJML_PROCEDURE`. Default is api.

### API procedure

[](#api-procedure)

To render MJML via the API, you must set the following environment variables:

```
MJML_PROCEDURE=api
MJML_APP_ID=your-application-id
MJML_SECRET_KEY=your-secret-key

```

You can also omit `MJML_PROCEDURE`, as the default value is api. The API credentials can request [here](https://mjml.io/api)

### CLI procedure

[](#cli-procedure)

If you prefer not to render MJML via the API, you can use the [NPM package](https://www.npmjs.com/package/mjml). You must install this in advance and set the following enviroment variables:

```
MJML_PROCEDURE=cli
MJML_CLI_PATH=path_to_your_mjml_package

```

`MJML_CLI_PATH` has the default value `node_modules/.bin/mjml`, you only need to set this variable if the path to your MJML package differs.

Example
-------

[](#example)

Now you can use MJML for your Laravel Mails. For example, you can use MJML to verify the email after registration. To use Email Verification in your Laravel App, see the documentation [here](https://laravel.com/docs/11.x/verification).

### Add an MJML Template to your ressource path:

[](#add-an-mjml-template-to-your-ressource-path)

`resources\views\emails\notifications\verify.mjml.blade.php`

The Template File must have the `mjml.blade.php` extension.

```

                {{ $verificationUrl }}

```

If you want to use Blade directives, you must wrapped this in `mj-raw` tags:

```

                @if (true)
                {{ $someVariable }}
                @endif

```

### Create a Mailable

[](#create-a-mailable)

To create a Mailable use the artisan command: `php artisan make:mail VerifyEmail`

### Customize the class

[](#customize-the-class)

In your Mailable class generated by laravel, you must now adjust the following:

```
use DayLaborers\LaravelMjml\Mail\MjmlMailable;

class VerifyEmail extends MjmlMailable
{
    /**
     * @param string $verificationUrl
     */
    public function __construct(protected string $verificationUrl)
    {
        //
    }

    /**
     * @return Content
     */
    public function content(): Content
    {
        return new Content(
            view: 'emails.notifications.verify',
            with: [
                'verificationUrl' => $this->verificationUrl
            ]
        );
    }
}

```

Of course, you can pass more variables and customize things as described in the Laravel documentation.

### Customize the email verification

[](#customize-the-email-verification)

Open the `AppServiceProvider.php` class and add this:

```
use Illuminate\Auth\Notifications\VerifyEmail;
use Illuminate\Support\ServiceProvider;
use App\Mail\VerifyEmail as MjmlVerifyEmail;

public function boot(): void
{
    // ...

    VerifyEmail::toMailUsing(function (object $notifiable, string $url) {
        return (new MjmlVerifyEmail($url))
            ->to($notifiable->email)
            ->subject('Verify Email Address');
    });
}

```

Now the verification Mail is rendered with MJML.

That's it! You have successfully installed and configured the MJML package for use.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity54

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 ~4 days

Total

2

Last Release

765d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6a9fade2cce0c90a34a0717dc23b65a8d5b7fcbcf64b21c1d92d8dbe40c41ef3?d=identicon)[nubos](/maintainers/nubos)

---

Top Contributors

[![homeoftheunits](https://avatars.githubusercontent.com/u/2916844?v=4)](https://github.com/homeoftheunits "homeoftheunits (12 commits)")

### Embed Badge

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

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

###  Alternatives

[tijsverkoyen/css-to-inline-styles

CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.

5.8k505.3M227](/packages/tijsverkoyen-css-to-inline-styles)[minishlink/web-push

Web Push library for PHP

1.9k12.0M53](/packages/minishlink-web-push)[mattketmo/email-checker

Throwaway email detection library

2742.0M5](/packages/mattketmo-email-checker)[asahasrabuddhe/laravel-mjml

A package that enables using MJML with Laravel Mailables.

128530.9k](/packages/asahasrabuddhe-laravel-mjml)[terminal42/notification_center

Notification Center extension for Contao Open Source CMS

68396.6k78](/packages/terminal42-notification-center)[netflie/laravel-notification-whatsapp

Laravel notification driver for WhatsApp

176173.9k](/packages/netflie-laravel-notification-whatsapp)

PHPackages © 2026

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