liujinyong / laravel-dingding
基于钉钉开放平台的laravel-php-api集成
Installs: 19
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/liujinyong/laravel-dingding
Requires
- php: ^8.2
- guzzlehttp/guzzle: ^7.9.2
README
基于laravel11版本开发组件库
【使用前准备】
- 步骤一:完成创建应用的流程
- 步骤二:获取应用凭证信息,获取应用 Client ID 、Client Secret和AgentID
- 步骤三:申请接口权限,申请工作通知相关接口的权限。
【使用方法】
<?php require __DIR__ . '/../vendor/autoload.php'; use Liujinyong\LaravelDingding\Handler\users; use Liujinyong\LaravelDingding\Handler\message; $clientId = ""; $clientSecret = ""; $agentId = ""; //【用户信息】 $handle = new users\UserController($clientId, $clientSecret, $agentId); //根据手机号获取用户ID $userId = $handle->getUserIdByMobile("153****2234"); //更据用户ID获取用户信息 $user = $handle->getUserInfo('052*********5003'); //【工作通知】 $handle = new message\MessageController($clientId, $clientSecret, $agentId); //发送工作消息通知 参数可参考 // https://open.dingtalk.com/document/development/message-types-and-data-format $message = $handle->workNotification($msg, $userIdList, $deptIdList, $toAllUser); //获取工作消息通知结果 参数可参考 // https://open.dingtalk.com/document/development/gets-the-result-of-sending-messages-asynchronously-to-the-enterprise $message = $handle->getNotificationResult($taskId); //自定义机器人发送消息 // https://open.dingtalk.com/document/development/custom-robots-send-group-messages $hander = new \Liujinyong\LaravelDingding\Handler\robot\RobotController(['secret' => '加签字符串']); $result = $hander->send('robot_send',['access_token'=>'access_token'],['msgtype'=>'text','text'=>['content'=>'你好哇'],'at'=>['isAtAll'=>true]],true);