notifier / notifier-bundle
Symfony 的 Notifier 集成
dev-master
2014-11-11 02:59 UTC
Requires
- php: >=5.3.0
- notifier/notifier: ~2.0@dev
- symfony/framework-bundle: ~2.4
This package is auto-updated.
Last update: 2024-08-29 03:31:28 UTC
README
为 symfony 项目提供 Notifier 集成。
安装
通过以下简单步骤安装此包
- 将包添加到您的项目作为 composer 依赖项
// composer.json { // ... require: { // ... "notifier/notifier-bundle": "~1.0" } }
- 更新您的 composer 安装
composer update
- 将包添加到您的应用程序内核
// app/AppKernel.php public function registerBundles() { // ... $bundle = array( // ... new Notifier\NotifierBundle\NotifierNotifierBundle(), ); // ... return $bundles; }
使用方法
实现数据提供者
实现 \Notifier\NotifierBundle\Notifier\RecipientChannelResolverInterface
并将其注册为一个服务。然后将该服务标识符注册为 recipient_channel_resolver
。
配置类型
config.yml
notifier:
recipient_channel_resolver: "acme.recipient_channel_resolver"
types:
alert:
channels: [ "acme.mail_channel" ]
确保所有通道都解析为项目中定义的现有服务。
发送消息
use Notifier\Message\Message;
use Notifier\Recipient\Recipient;
use Notifier\NotifierBundle\Type\Type;
// ...
$message = new Message(new Type('alert'));
$this->get('notifier')->sendMessage($message, array(new Recipient('identifier')));
贡献
所有代码贡献 - 包括有提交权限的人的贡献 - 必须通过 pull request 进行,并由核心开发者批准后再合并。这是为了确保对所有代码的适当审查。
将项目分支,创建一个功能分支,并给我们发送一个 pull request。
为了确保代码库的一致性,您应该确保代码遵循我们从 Symfony 借来的 编码标准。请务必检查 php-cs-fixer,这将对您有很大帮助。
如果您想帮忙,请查看 问题列表。
需求
PHP 5.3.2 或更高版本
作者和贡献者
Dries De Peuter - dries@nousefreak.be - http://nousefreak.be
还可以查看参与此项目的 贡献者列表。
许可证
NotifierBundle 在 MIT 许可证下授权。