astrotomic / notifynder-sender-slack
此包已弃用,不再维护。未建议替代包。
Notifynder包的Slack发送器。
1.1.0
2017-02-09 13:31 UTC
Requires
- php: >=5.5.0
- fenos/notifynder: ^4.0
- illuminate/support: ~5.0
- maknz/slack: ^1.7
Requires (Dev)
- laravel/framework: ~5.0
This package is not auto-updated.
Last update: 2019-10-22 12:03:01 UTC
README
文档: Notifynder 文档
安装
步骤 1
composer require astrotomic/notifynder-sender-slack
步骤 2
将以下字符串添加到 config/app.php
提供者数组
Astrotomic\Notifynder\NotifynderSenderSlackServiceProvider::class,
步骤 3
将以下数组添加到 config/notifynder.php
'senders' => [ 'slack' => [ 'webhook' => 'https://hooks.slack.com/...', 'store' => false, // wether you want to also store the notifications in database ], ],
在你的 app/Providers/AppServiceProvider.php
中注册发送器回调
<?php namespace App\Providers; use Illuminate\Support\ServiceProvider; use Astrotomic\Notifynder\Senders\SlackSender; use Maknz\Slack\Message as SlackMessage; use Fenos\Notifynder\Builder\Notification; class AppServiceProvider extends ServiceProvider { public function boot() { app('notifynder.sender')->setCallback(SlackSender::class, function (SlackMessage $message, Notification $notification) { // handle the message and append the from, to, icon and so on // https://github.com/maknz/slack#explicit-message-creation // you don't have to set the message text, by default (if empty) it is set in the sender itself // just return the message, don't send it - otherwise you will get the message two times return $message; }); } }