mote/email-templater
Composer 安装命令:
composer require mote/email-templater
包简介
A PHP email templating library, flexible enough to work with most libraries and frameworks
README 文档
README
Entirely configurable. Can easily be made to work with any email-sending library.
NOTE: This library is still in development, and not fully tested. Should work fine, but you should test it yourself (and submit bug reports or fixes!).
Usage for ZF2:
<?php use Mote\EmailTemplater as Et; $templater = new Et\Templater(...); $transport = new \Zend\Mail\Transport\Sendmail(); try { $zendMessage = $templater->fromTemplate( 'myEmailTemplate', array( 'templateParam1' => 'Something...', 'templateParam2' => 'Something else...', ) )->convert('zf2'); // Or just ->convert() if "zf2" is set in constructor as default $zendMessage->setFrom('admin@localhost') ->setTo('someone@somewhere.com'); $transport->send($zendMessage); } catch (Et\TemplateNotFoundException $e) { echo 'Could not find template'; } catch (Et\Processor\InvalidTemplateException $e) { echo 'The template found was invalid'; } catch (Et\Processor\ProcessingException $e) { echo 'Generic processing exception'; }
For full example, see example/ folder
TO-DO
- Have (all) exceptions inherit from a catch-all (match as per ZF2 standards)
- (Separate) ZF2 module built upon this
- "@include FILE_NAME" support in JSON to have fields in separate files
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-02-03