2024-01-31 09:30:04 +08:00
|
|
|
|
|
|
|
|
|
## 消息通知组件
|
|
|
|
|
|
|
|
|
|
## 功能
|
|
|
|
|
|
|
|
|
|
* 监控发送应用异常
|
|
|
|
|
* 支持多种通道(钉钉群机器人、飞书群机器人、邮件、QQ 频道机器人、企业微信群机器人)
|
|
|
|
|
* 支持扩展自定义通道
|
|
|
|
|
|
|
|
|
|
## 环境要求
|
|
|
|
|
|
|
|
|
|
* hyperf >= 2.0
|
|
|
|
|
|
|
|
|
|
## 安装
|
|
|
|
|
|
|
|
|
|
```bash
|
2024-01-31 09:34:00 +08:00
|
|
|
|
composer require ykxiao/easy-message -vvv
|
2024-01-31 09:30:04 +08:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## 配置文件
|
|
|
|
|
|
|
|
|
|
发布配置文件`config/message.php`
|
|
|
|
|
|
|
|
|
|
```bash
|
2024-01-31 09:54:51 +08:00
|
|
|
|
php bin/hyperf.php vendor:publish ykxiao/easy-message
|
2024-01-31 09:30:04 +08:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## 使用
|
|
|
|
|
```php
|
|
|
|
|
Notify::make()->setChannel(DingTalkChannel::class)
|
|
|
|
|
->setTemplate(Text::class)
|
|
|
|
|
->setTitle('标题')->setText('内容')->setAt(['all'])->setPipeline('info')
|
|
|
|
|
->send();
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## 通道
|
|
|
|
|
|
2024-01-31 09:34:00 +08:00
|
|
|
|
| 通道名称 | 命名空间 | 支持格式 |
|
|
|
|
|
|-------|--------------------------------------|---------------|
|
|
|
|
|
| 钉钉群 | \EasyMessage\Channel\DingTalkChannel | Text、Markdown |
|
|
|
|
|
| 飞书群 | \EasyMessage\Channel\FeiShuChannel | Text、Markdown |
|
|
|
|
|
| 企业微信群 | \EasyMessage\Channel\WechatChannel | Text、Markdown |
|
2024-01-31 09:30:04 +08:00
|
|
|
|
|
|
|
|
|
## 格式
|
|
|
|
|
|
|
|
|
|
| 格式名称 | 命名空间 |
|
|
|
|
|
|----------|----------------------------------|
|
2024-01-31 09:34:00 +08:00
|
|
|
|
| Text | \EasyMessage\Template\Text |
|
|
|
|
|
| Markdown | \EasyMessage\Template\Markdown |
|
2024-01-31 09:30:04 +08:00
|
|
|
|
|
|
|
|
|
## 协议
|
|
|
|
|
|
2024-01-31 09:34:00 +08:00
|
|
|
|
MIT 许可证(MIT)。有关更多信息,请参见[协议文件](LICENSE)。
|