1. Go to this page and download the library: Download pl1998/dingtalk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pl1998 / dingtalk example snippets
use ThinkCar\DingTalk\Facades\Robot;
use ThinkCar\DingTalk\Robot\Message\Text;
$text = new Text;
$text->content = '这是发送内容';
$text->At('123232321'); //表示@123232321
$text->addContent("为hello world!") // 将会与上面的内容拼接
$text->At("13911111111");//还可以继续@用户 addContent() 和At() 支持链式调用;
$response = Robot::push($text);
//判断消息是否推送成功
$response->isSuccess():bool;
//获取返回的数据结果
$response->getOrigin();
$text = new Text('这是发送内容');
Robot::push($text); // or app('ding.robot')->push($text);