yiisoft/mailer-view
Composer 安装命令:
composer require yiisoft/mailer-view
包简介
Yii Mailer message body rendering extension
README 文档
README
Yii Mailer View
This Yii Mailer extension provides classes for composing message body via view rendering:
MessageBodyRenderer- a view renderer used to compose message body.ViewMailer- a mailer decorator withcompose()method.
Requirements
- PHP 8.1 or higher.
Installation
The package could be installed with Composer:
composer require yiisoft/mailer-view
General usage
Message body renderer
use Yiisoft\Mailer\View\MessageBodyRenderer; use Yiisoft\Mailer\View\MessageBodyTemplate; use Yiisoft\View\View; $renderer = new MessageBodyRenderer( new View(), new MessageBodyTemplate( __DIR__ . '/views', 'html-layout', ), ); // HTML body $htmlBody = $renderer->renderHtml( view: 'html-content', viewParameters: ['count' => 42], layoutParameters: ['header' => 'Hello!'], ); // Text body $textBody = $renderer->renderText( view: 'html-content', viewParameters: ['count' => 42], layoutParameters: ['header' => 'Hello!'], ); // Add body to message $message = $renderer->addBodyToMessage( message: new Message(), htmlView: 'html-content', viewParameters: ['count' => 42], layoutParameters: ['header' => 'Hello!'], );
If needed, you can pass textView parameter with the name of the text view.
Mailer decorator
/** * @var \Yiisoft\Mailer\MailerInterface $mailer * @var Yiisoft\Mailer\View\MessageBodyRenderer $messageBodyRenderer */ $viewMailer = new ViewMailer($mailer, $messageBodyRenderer); // Create message $message = $viewMailer->compose( htmlView: 'html-content', viewParameters: ['count' => 42], layoutParameters: ['header' => 'Hello!'], ); // Send message $viewMailer->send($message);
If needed, you can pass textView parameter with the name of the text view.
Documentation
If you need help or have a question, the Yii Forum is a good place for that. You may also check out other Yii Community Resources.
License
The Yii Mailer View is free software. It is released under the terms of the BSD License.
Please see LICENSE for more information.
Maintained by Yii Software.
Support the project
Follow updates
yiisoft/mailer-view 适用场景与选型建议
yiisoft/mailer-view 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 4, 最近一次更新时间为 2024 年 10 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「mailer」 「view」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 yiisoft/mailer-view 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 yiisoft/mailer-view 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 yiisoft/mailer-view 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Shoot aims to make providing data to your templates more manageable
Illuminate View for Morningmedley.
Creates new sare mail transport for laravel applications
Blade template for Kirby
View5 is a version of Blade Templates for the Mvc5 Framework
Mandrill Api Integration for Yii2
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2024-10-16