the-real-start/yii2-async-notifications

异步邮件、推送和短信通知发送组件。

v1.2.3 2016-12-05 11:52 UTC

README

概述

本包的目的是在yii2项目中构建易于使用的异步通知系统。

包允许向苹果和谷歌播放云发送电子邮件和推送通知。

对于队列管理,使用Rabbit MQ

包相当原始,有很多改进空间。

我们欢迎新的pull请求和建议。

安装

通过composer安装此扩展是首选方式。

运行

php composer.phar require --prefer-dist the-real-start/yii2-async-notifications "*"

或在您的composer.json文件的require部分添加

"the-real-start/yii2-async-notifications": "*"

配置

common/config/main-local.php中添加amqp组件

...
        'amqp'          => [
            'class'        => TRS\AsyncNotification\components\amqp\Amqp::className(),
            'host'         => '127.0.0.1',
            'port'         => 5672,
            'user'         => 'guest',
            'password'     => 'guest',
            'vhost'        => '/',
            'exchange'     => 'my-exchange-name',
            'exchangeType' => \TRS\AsyncNotification\components\amqp\Amqp::TYPE_DIRECT,
            'exchangeArgs' => []
        ],
...

根据您的本地环境更改参数。

此组件设置与Rabbit MQ的连接。

然后设置您想要进行的通知。

例如邮件

...
        'mailer'        => [
            'class'            => 'yii\swiftmailer\Mailer',
            'viewPath'         => '@common/mail',
            // send all mails to a file by default. You have to set
            // 'useFileTransport' to false and configure a transport
            // for the mailer to send real emails.
            'useFileTransport' => false,
        ],
...

进行中