laravel-DingTalk是基于laravel5.5开发的钉钉机器人
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
config first commit Nov 8, 2018
src
README.md
composer.json

README.md

laravel-DingTalk是基于laravel5.5开发的钉钉机器人

当前自定义机器人支持
文本(text)、链接(link)、markdown(markdown)三种消息类型
大家可以根据自己的使用场景选择合适的消息类型,达到最好的展示样式

安装方法

1、安装

    composer require WXiangQian/laravel-DingTalk    
    composer install

    composer.json 中添加 "WXiangQian/laravel-DingTalk": "^1.0"  
    composer update 

1.0为版本号,可替换 如果无法安装 请执行一下 composer update nothing 然后 composer update

2、配置app.php

在config/app.php 'providers' 中添加

\Qian\DingTalk\DingTalkServiceProvider::class

3、执行命令生成配置文件

   php artisan vendor:publish 
   则生成 config/dingtalk.php

实例

实现Text发送

$DingTalk = new DingTalk();
$message = new Message();
$data = $message->text('测试text类型');
$res = $DingTalk->send($data);
echo $res;

实现Link发送

$DingTalk = new DingTalk();
$message = new Message();
$title = '测试link类型title';
$text = '测试link类型text';
$messageUrl = 'https://www.baidu.com/';
$picUrl = '';
$data = $message->link($title, $text, $messageUrl, $picUrl);
$res = $DingTalk->send($data);
echo $res;

实现Markdown发送

$DingTalk = new DingTalk();
$message = new Message();
$title = '北京天气MD';
$text = '# laravel-DingTalk是基于laravel5.5开发的钉钉机器人';
$data = $message->markdown($title, $text);
$res = $DingTalk->send($data);
echo $res;

如满足您的需求,请留下来点个赞吧