lee2son / dingtalk-robot
钉钉消息发送机器人
v1.0.0
2020-01-31 10:11 UTC
Requires
- php: >=5.6.0
- guzzlehttp/guzzle: ^6.0
This package is auto-updated.
Last update: 2024-09-29 05:35:51 UTC
README
Laravel 框架的钉钉机器人消息插件
安装
composer require lee2son/dingtalk-robot
在普通PHP项目中使用:
include_once __DIR__ . '/vendor/autoload.php';
\Lee2son\DingTalkRobot\Robot::$apps = [
'example' => [
'webhook' => 'https://oapi.dingtalk.com/robot/send?access_token=xxxxxxxx',
// The "GuzzleHttp" options
// http://docs.guzzlephp.org/en/stable/request-options.html
'options' => [
'verify' => false,
],
'sign_type' => 'sign',
'secret' => 'xxxxxxxxxxx',
]
];
\Lee2son\DingTalkRobot\robot('example')->xxxxxxxxx();
// or
\Lee2son\DingTalkRobot\Robot::$default = 'example';
\Lee2son\DingTalkRobot\robot()->xxxxxxxxx();
// or
$robot = new \Lee2son\DingTalkRobot\Robot([
'webhook' => 'https://oapi.dingtalk.com/robot/send?access_token=xxxxxxxx',
// The "GuzzleHttp" options
// http://docs.guzzlephp.org/en/stable/request-options.html
'options' => [
'verify' => false,
],
'sign_type' => 'sign',
'secret' => 'xxxxxxxxxxx',
]);
$robot->xxxxxxxxx();
在 Laravel 中使用
配置:
php artisan vendor:publish --tag=dingtalk-robot
此时会生成config/dingtalk_robot.php
,请根据需要修改。调用方式相同。
app('dingtalk.robot', 'example')->xxxxxxxxx();