63 lines
928 B
Markdown
63 lines
928 B
Markdown
## 三方平台消息通知组件
|
|
|
|
## 功能
|
|
|
|
* 支持钉钉群机器人、飞书群机器人、企业微信群机器人
|
|
* 支持扩展自定义通道&消息模板
|
|
|
|
## 环境要求
|
|
|
|
* hyperf >= 2.2
|
|
|
|
## 安装
|
|
|
|
### 设置仓库
|
|
```json
|
|
{
|
|
"repositories": [{
|
|
"type": "composer",
|
|
"url": "http://192.168.21.189"
|
|
}]
|
|
}
|
|
|
|
```
|
|
|
|
```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);
|
|
|
|
```
|
|
|