PHP code example of lucifersf / dingtalk-third-enterprise
1. Go to this page and download the library: Download lucifersf/dingtalk-third-enterprise 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/ */
lucifersf / dingtalk-third-enterprise example snippets
use Lucifer\DingTalk\ThirdParty\Enterprise\Application;
$config = [
'suite_key' => 'your suite_key',
'suite_secret' => 'your suite_secret'
];
$app = new Application($config);
//获取企业凭证
$app->auth->getAccessToken($suiteTicket, $corpId);
//第三方企业应用免登获取用户userid
$app->user->withAccessToken($accessToken)->getUserId($code);
//获取用户详情
$app->user->withAccessToken($accessToken)->get($userId);