PHP code example of zcmzc / dingding-robot
1. Go to this page and download the library: Download zcmzc/dingding-robot 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/ */
zcmzc / dingding-robot example snippets
namespace DingRobotTest\Robot;
class TestRobot extends \DingRobot\AbstractRobot
{
public function getWebhook(): string
{
return 'https://oapi.dingtalk.com/robot/send?access_token=';
}
public function getName(): string
{
return '自定义';
}
}
use DingRobotTest\Robot\TestRobot;
use GuzzleHttp\Client;
use DingRobot\Message\TextMessage;
(new TestRobot(new Client()))->send(new TextMessage('这是测试消息'));