stayallive/laravel-mail-css-inliner
最新稳定版本:v4.5.0
Composer 安装命令:
composer require stayallive/laravel-mail-css-inliner
包简介
Inline the CSS of your Laravel HTML emails.
README 文档
README
Why?
Most email clients won't render CSS (on a <link> or a <style>). The solution is inline your CSS directly on the HTML.
Doing this by hand easily turns into unmaintainable templates. The goal of this package is to automate the process of inlining that CSS before sending the emails.
How?
Using a wonderful CSS inliner package wrapped in a SwiftMailer plugin and served as a Service Provider it just works without any configuration. Since this is a SwiftMailer plugin, it will automatically inline your css when parsing an email template. You don't have to do anything!
Turns style tag:
<html> <head> <style> h1 { font-size: 24px; color: #000; } </style> </head> <body> <h1>Hey you</h1> </body> </html>
Or the link tag:
<html> <head> <link rel="stylesheet" type="text/css" href="./tests/css/test.css"> </head> <body> <h1>Hey you</h1> </body> </html>
Into this:
<html> <head> <style> h1 { font-size: 24px; color: #000; } </style> </head> <body> <h1 style="font-size: 24px; color: #000;">Hey you</h1> </body> </html>
Installation
This package requires at least Laravel 9 and PHP 8.
Begin by installing this package through composer. Require it directly from the CLI to take the last stable version:
composer require stayallive/laravel-mail-css-inliner
At this point the inliner should be already working with the default options. If you want to fine-tune these options, you can do so by publishing the configuration file:
$ php artisan vendor:publish --provider='Stayallive\LaravelMailCssInliner\ServiceProvider'
and changing the settings on the generated config/mail-css-inliner.php file.
Testing
composer test
Found a bug?
Please, let me know! Send a pull request or a patch. Questions? Ask! I will respond to all filed issues.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email me@alexbouma.me instead of using the issue tracker.
Credits
This is a fork from fedeisas/laravel-mail-css-inliner.
The forked package is greatly inspired, and mostly copied, from SwiftMailer CSS Inliner.
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 88.43k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-03-29