limingxinleo / x-dingtalk
钉钉机器人
v2.0.0-alpha
2021-09-10 10:09 UTC
Requires
- php: >=7.3
- guzzlehttp/guzzle: ^6.3|^7.0
- hyperf/utils: ^2.0
- pimple/pimple: ^3.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- mockery/mockery: ^1.0
- phpstan/phpstan: ^0.12
- phpunit/phpunit: >=7.0
- swoole/ide-helper: ^4.5
- swow/swow: dev-develop
- symfony/var-dumper: ^5.1
This package is auto-updated.
Last update: 2024-12-10 17:08:14 UTC
README
自定义机器人
- 初始化
<?php use Fan\DingTalk\Application; $config = [ // HTTP 请求的超时时间(秒) 'timeout' => 5.0, // 机器人模块 'robot' => [ 'gateways' => [ 'test' => [ 'url' => $url, ], 'test2' => [ 'url' => $url, ], ], ], ]; $ding = new Application($config);
- 发送消息
<?php /** @var \Psr\Http\Message\ResponseInterface[] $res */ $res = $ding->robot->sendText('测试sendText方法', [], ['test']); /** @var \Psr\Http\Message\ResponseInterface[] $res */ $res = $this->ding->robot->sendMarkdown( '杭州天气', "#### 杭州天气 @156xxxx8827\n" . "> 9度,西北风1级,空气良89,相对温度73%\n\n" . "> ![screenshot](https://avatars0.githubusercontent.com/u/16648551?s=460&v=4)\n" . "> ###### 10点20分发布 [天气](http://www.thinkpage.cn/) \n", [], ['test'] );