icanboogie/bind-mailer

将 icanboogie/prototype 绑定到 ICanBoogie。

dev-master 2015-08-23 11:25 UTC

This package is auto-updated.

Last update: 2024-09-07 21:16:04 UTC


README

Release Build Status HHVM Code Quality Code Coverage Packagist

icanboogie/bind-mailer 包将 icanboogie/mailer 绑定到 ICanBoogie,使用其 Autoconfig 功能。它提供了一个配置合成器用于 mailer 配置以及原型绑定用于 Core 实例。

<?php

namespace ICanBoogie;

require 'vendor/autoload.php';

$app = boot();

$config = $app->configs['mailer']; // obtain the "mailer" config.
$config['deliverer'];              // class name or callable to create the deliverer instance.
$config['mailer'];                 // class name or callable to create the mailer instance.

$app->mailer; //instance of ICanBoogie\Mailer\Mailer;
$app->mail([

	'to' => "example@example.com",
	'from' => "me@example.com",
	'subject' => "Testing",
	'body' => "Hello world!"

], $options = []);

消息发送前后

如果 sendermail() 选项中定义,则触发以下事件

  • 在消息通过邮件发送器发送之前,将触发类 BeforeMailEvent<class>:mail:before 事件。第三方可以使用此事件修改消息或用于发送消息的邮件发送器。

  • 消息通过邮件发送器发送后,将触发类 MailEvent<class>:mail 事件。第三方可以使用此事件修改邮件发送器返回的结果。

其中 <class> 是发送者的类。

要求

该包需要 PHP 5.5 或更高版本。

安装

安装此包的推荐方法是使用 Composer

$ composer require icanboogie/bind-mailer

该包仅指定了最低版本,同时要求 icanboogie/icanboogie 和 [icanboogie/prototype],您可能需要在 "composer.json" 文件中指定要使用的版本。

克隆仓库

该包在 GitHub 上可用,可以使用以下命令行进行克隆

$ git clone https://github.com/ICanBoogie/bind-mailer.git

文档

该包作为 ICanBoogie 框架的一部分进行了文档化 文档。您可以使用 make doc 命令生成包及其依赖项的文档。文档生成在 build/docs 目录中。需要 ApiGen。可以使用 make clean 命令清理该目录。

测试

测试套件通过 make test 命令运行。需要全局可用的 PHPUnitComposer 来运行套件。该命令根据需要安装依赖项。使用 make test-coverage 命令运行测试套件并在 "build/coverage" 中创建 HTML 覆盖率报告。可以使用 make clean 命令清理该目录。

该包由 Travis CI 持续测试。

Build Status Code Coverage

许可证

icanboogie/bind-mailer 在新 BSD 许可证下授权 - 详细信息请参阅 LICENSE 文件。