消息通知集合包 钉钉 √ 微信 ....... 通知渠道 laravel 适配
$ composer require jiuxiaoer/notice -vvv
在使用本扩展之前,你需要去钉钉群创建一个自定义机器人 获取到 Webhook 和 加签值 https://open.dingtalk.com/document/group/custom-robot-access
use Jiuxiaoer\Notice\lib\DingMsg;
$key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxx';
$sign = 'xxxxxxxxxxxxxxxxxxxxxxxxxxx';
$dingMsg = new DingMsg($key,$sign);
$dingMsg->text('普通消息测试', ['1769xxxxxxx'])
$dingMsg->link('链接测试', '欢迎Ceo!', 'https://www.79xj.cn/', 'https://www.79xj.cn/usr/uploads/2021/03/44950235.jpg')
$dingMsg->markdown('Markdown 测试', "#### Markdown 测试", ['1769xxxxxxx'])
$dingMsg->actionCard('我 20 年前想打造一间苹果咖啡厅,而它正是 Apple Store 的前身',
"![screenshot](https://img.alicdn.com/tfs/TB1NwmBEL9TBuNjy1zbXXXpepXa-2400-1218.png) \n\n #### 乔布斯 20 年前想打造的苹果咖啡厅 \n\n Apple Store 的设计正从原来满满的科技感走向生活化,而其生活化的走向其实可以追溯到 20 年前苹果一个建立咖啡馆的计划"
, '阅读全文', 'https://www.dingtalk.com/', '0')
$dingMsg->actionCardAlone('我 20 年前想打造一间苹果咖啡厅,而它正是 Apple Store 的前身',
"![screenshot](https://img.alicdn.com/tfs/TB1NwmBEL9TBuNjy1zbXXXpepXa-2400-1218.png) \n\n #### 乔布斯 20 年前想打造的苹果咖啡厅 \n\n Apple Store 的设计正从原来满满的科技感走向生活化,而其生活化的走向其实可以追溯到 20 年前苹果一个建立咖啡馆的计划"
, [['title' => '6666', 'actionURL' => 'https://www.79xj.cn'], ['title' => '6666', 'actionURL' => 'https://www.79xj.cn']])
在 Laravel 中使用也是同样的安装方式,配置写在 config/services.php
中:
.
.
.
'notice' => [
'dingKey' => env('DING_KEY'),
'dingSign' => env('DING_SIGON'),
],
然后在 .env
中配置 dingKey dingSign
:
DING_KEY=xxxxxxxxxxxxxxxxxxxxx
DING_SIGON=xxxxxxxxxxxxxxxxxxxxx
可以用两种方式来获取 Jiuxiaoer\Notice\lib\DingMsg
实例:
.
.
.
public function edit(DingMsg $weather)
{
$response = $dingMsg->txt('测试');
}
.
.
.
.
.
.
public function edit()
{
$response = app('dingMsg')->txt('测试');
}
.
.
.
https://open.dingtalk.com/document/group/custom-robot-access
MIT