52 lines
808 B
Markdown
52 lines
808 B
Markdown
|
## 三方平台消息通知组件
|
||
|
|
||
|
## 功能
|
||
|
|
||
|
* 支持钉钉群机器人、飞书群机器人、企业微信群机器人
|
||
|
* 支持扩展自定义通道&消息模板
|
||
|
|
||
|
## 环境要求
|
||
|
|
||
|
* hyperf >= 2.2
|
||
|
|
||
|
## 安装
|
||
|
|
||
|
```sh
|
||
|
composer require tm-wms/message-notify
|
||
|
```
|
||
|
|
||
|
## 配置文件
|
||
|
|
||
|
发布配置文件`config/message_notify.php`
|
||
|
|
||
|
```sh
|
||
|
php bin/hyperf.php vendor:publish tm-wms/message-notify
|
||
|
```
|
||
|
|
||
|
## 使用
|
||
|
|
||
|
```php
|
||
|
<?php
|
||
|
|
||
|
use TmWms\MessageNotify\Notify;
|
||
|
use TmWms\MessageNotify\Channel\DingTalkChannel;
|
||
|
use TmWms\MessageNotify\Template\Text\DingTalk;
|
||
|
|
||
|
// 初始通道
|
||
|
$channel = new DingTalkChannel();
|
||
|
|
||
|
// 初始消息模板
|
||
|
$template = (new DingTalk())
|
||
|
->setTitle('test')
|
||
|
->setText('test')
|
||
|
//@所有人
|
||
|
->setAt([
|
||
|
'all'
|
||
|
]);
|
||
|
|
||
|
// 发送
|
||
|
Notify::make($channel)->send($template);
|
||
|
|
||
|
```
|
||
|
|