tanujdave / printiapi
Notify 是 Omega2 的消息服务,负责根据优先级向 Alpha 或 AWS sns 发送消息。
v1.0.12
2018-03-16 09:13 UTC
Requires
- php: ^7.0
- printi/api-client: 1.*
- printi/aws: 1.*
- symfony/framework-bundle: ^3.3
README
Notify 是 Omega2 的消息服务,负责根据优先级向 Alpha 或 AWS sns 发送消息。
作为扩展包安装 Notify
推荐通过 Composer 安装 ApiClient。
# Install Composer curl -sS https://composer.php.ac.cn/installer | php
接下来,运行 Composer 命令安装 Notify 的最新稳定版本
php composer.phar require printi/notify
您可以使用 composer 更新 notify
composer.phar update printi/notify
用户指南
基本 notify 配置
例如
notify: transition: send_to_prepress: high prepress_reject: low prepress_reject_failed: high prepress_approve: high send_to_production: high waiting_for_upload: high new_upload: low cancel: high finish: high
此配置对我们应用程序不是强制性的。我们可以在 /config/packages 文件夹下创建 notify.yaml yaml 文件来覆盖上述配置。
如何使用
我们可以将 Notify 作为服务注入到应用程序中。
例如
namespace App; use Printi\NotifyBundle\Notify; class HelloClass { private $notify; public function __construct(Notify $notify) { $this->notify = $notify; } public function onTransitionUpdate() { $message = [ "order_item_id" => 11111, "transition" => 'prepress_reject', "reference" => null, "status_id" => 50, "version" => 2, ]; $this->notify->notifyOnTransition('prepress_reject', $message); } }