deezin/laravel-mjml
Composer 安装命令:
composer require deezin/laravel-mjml
包简介
A package that enables using MJML with Laravel Mailables.
README 文档
README
Build responsive e-mails easily using MJML and Laravel Mailables.
MJML
MJML is an awesome tool from MailJet that allows us to create responsive emails very easily. For more information on how to use it, head to their documentation here
Installation
To install this package, require this package using composer as follows:
composer require asahasrabuddhe/laravel-mjml
After composer installs the packages and all the dependencies, publish the package configuration using artisan command:
php artisan vendor:publish
Select the laravel-mjml in the list. You will also need to install the MJML CLI:
npm install --save mjml
Getting Started
-
Create a view containing MJML in your resources/views directory.
-
Create a mailable class using artisan command:
php artisan make:mail MJMLEmail -
In the mailable class, replace
use Illuminate\Mail\Mailable;with
use Asahasrabuddhe\LaravelMJML\Mail\Mailable; -
For Laravel 8 and below, in the
buildmethod, use:public function build() { return $this->mjml('view.name') }
For Laravel 9, in the
contentmethod:, use:public function content() { return new Content( view: $this->mjml('view.name')->buildMjmlView()['html'], ); }
Configuration
By default, the package will automatically detect the path of the MJML CLI installed locally in the project. In case this does not happen or the MJML CLI is installed globally, please update the configuration file likewise.
That's it! You have successfully installed and configured the MJML package for use. Just create new views and use them in the mailables class.
deezin/laravel-mjml 适用场景与选型建议
deezin/laravel-mjml 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12.26k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 03 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 deezin/laravel-mjml 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 deezin/laravel-mjml 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 12.26k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-03-25