Download the PHP package maize-tech/laravel-mjml without Composer
On this page you can find all versions of the php package maize-tech/laravel-mjml. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download maize-tech/laravel-mjml
More information about maize-tech/laravel-mjml
Files in maize-tech/laravel-mjml
Package laravel-mjml
Short Description Responsive MJML emails for Laravel
License MIT
Homepage https://github.com/maize-tech/laravel-mjml
Informations about the package laravel-mjml
Laravel MJML
Laravel MJML lets you write responsive HTML emails with MJML directly inside your Blade templates. Any view named *.mjml.blade.php is first compiled by the Blade engine and then converted to production-ready, email-client-safe HTML, so you keep the full power of Blade (components, slots, directives, localization) while authoring with MJML's concise, responsive syntax.
The package registers a dedicated mjml view engine, ships a set of ready-to-use Blade email components and a notification-friendly MailMessage, and supports three conversion backends out of the box: a local Node renderer (default), the hosted MJML API, or your own custom action.
Installation
You can install the package via composer:
You can publish the config file and the views with the install command:
This is the contents of the published config file:
Usage
Conversion modes
The mode config option determines how MJML markup is turned into HTML.
ConversionMode::Node (the default) renders MJML locally through spatie/mjml-php, which relies on the mjml Node binary:
ConversionMode::API sends the MJML markup to the hosted MJML API and requires the following environment variables:
ConversionMode::Custom lets you provide your own invokable action. It receives the compiled MJML string and must return the rendered HTML:
Notifications
Use the package's MailMessage inside a notification's toMail method to render the notification with MJML instead of the default Laravel mail template. It extends Laravel's MailMessage, so the familiar fluent API (greeting, line, action, salutation, ...) keeps working:
Custom MJML views
Any view whose name ends with .mjml.blade.php is automatically compiled by Blade and converted to HTML. You can use it like any other Blade view — for example as a mailable view:
Blade components
When you publish the views, a set of x-mjml::* Blade components becomes available to help you build consistent, well-styled emails:
| Component | Description | Notable props |
|---|---|---|
x-mjml::layout |
Full email scaffold with header, body, optional subcopy and footer slots. | — |
x-mjml::message |
Notification-style body: greeting, intro/outro lines, action button and salutation. | — |
x-mjml::header |
Top section rendering the application name (or the Laravel logo). | url |
x-mjml::footer |
Centered footer text (Markdown supported). | — |
x-mjml::button |
Call-to-action button. | url, color (default #2d3748), align (default center) |
x-mjml::line |
A line of text with Markdown parsing. | — |
x-mjml::panel |
Highlighted panel with a left border. | — |
x-mjml::subcopy |
Secondary text separated by a divider. | — |
Example:
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Riccardo Dalla Via
- Enrico De Lazzari
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-mjml with dependencies
illuminate/contracts Version ^11.0||^12.0||^13.0
spatie/laravel-package-tools Version ^1.16.6
spatie/mjml-php Version ^1.2