PHPackages                             draguo/dingtalk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. draguo/dingtalk

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

draguo/dingtalk
===============

dingtalk sdk

0.1.0(7y ago)088MITPHPPHP &gt;=5.5.9

Since Aug 16Pushed 6y ago1 watchersCompare

[ Source](https://github.com/draguo/dingtalk)[ Packagist](https://packagist.org/packages/draguo/dingtalk)[ RSS](/packages/draguo-dingtalk/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

 [](#ug5gkf)钉钉 SDK
==================

[](#----钉钉-sdk)

请先阅读 [钉钉文档](https://open-doc.dingtalk.com/microapp/serverapi2)
--------------------------------------------------------------

[](#请先阅读-钉钉文档)

配置
--

[](#配置)

```
$config = [
    'corpid' => '',
    'corpsecret' => '',
    'socialite' => [
        'dashboard' => [
        'appid' => '',
        'appserect' => '',
        ]
    ],
    'microapp' => [
        'default' => '191027579',
    ]
];
```

群机器人
----

[](#群机器人)

### 使用

[](#使用)

首先[获取 access\_toekn](https://open-doc.dingtalk.com/microapp/serverapi2/qf2nxq)

```
// 传入 access_token= 后面的部分
$ding = new Robot($access_token);
```

#### @功能

[](#功能)

to 方法支持 @ 某人 或 @ 所有人， @ 指定人，可以是对应的手机号数组或以英文逗号分隔的字符串 @ 所有人，传入字符串 all

### 消息类型

[](#消息类型)

#### text 类型

[](#text-类型)

```
$message = new Text('hello world');
$result = $ding->to('all')->send($message);
// or
$result = $ding->to(['18912341234'])->send('hello world');
```

#### link 类型

[](#link-类型)

```
$link = new Link([
    "text" => "文字主体部分",
    "title" => "文字标题",
    "picUrl" => "",
    "messageUrl" => "https://mp.weixin.qq.com"
]);
$result = $notice->send($link);
```

#### markdown

[](#markdown)

```
$markdown = new Markdown([
    "title" => "杭州天气",
    "text" => "#### 杭州天气 @156xxxx8827\n".
        "> 9度，西北风1级，空气良89，相对温度73%\n\n".
        "> ![screenshot](http://image.jpg)\n".
        "> ###### 10点20分发布 [天气](http://www.thinkpage.cn/) \n"
]);
$result = $notice->send($markdown);
```

#### 整体跳转ActionCard类型

[](#整体跳转actioncard类型)

```
$card = new ActionCard([
    "title" => "乔布斯 20 年前想打造一间苹果咖啡厅，而它正是 Apple Store 的前身",
    "text" => "![screenshot](@lADOpwk3K80C0M0FoA)
               ### 乔布斯 20 年前想打造的苹果咖啡厅
               Apple Store 的设计正从原来满满的科技感走向生活化，而其生活化的走向其实可以追溯到 20 年前苹果一个建立咖啡馆的计划",
    "hideAvatar" => "0",
    "btnOrientation" => "0",
    "singleTitle" => "阅读全文",
    "singleURL" => "https://www.dingtalk.com/"
    ]);
$result = $notice->send($card);
```

#### 独立跳转ActionCard类型

[](#独立跳转actioncard类型)

```
$card = new ActionCard([
    "title" => "乔布斯 20 年前想打造一间苹果咖啡厅，而它正是 Apple Store 的前身",
    "text" => "![screenshot](@lADOpwk3K80C0M0FoA)
               ### 乔布斯 20 年前想打造的苹果咖啡厅
                Apple Store 的设计正从原来满满的科技感走向生活化，而其生活化的走向其实可以追溯到 20 年前苹果一个建立咖啡馆的计划",
    "hideAvatar" => "0",
    "btnOrientation" => "0",
    "btns" => [
        [
            "title" => "内容不错",
            "actionURL" => "https://www.dingtalk.com/"
        ],
        [
            "title" => "不感兴趣",
            "actionURL" => "https://www.dingtalk.com/"
        ]
    ]
]);
$result = $notice->send($card);
```

#### FeedCard类型

[](#feedcard类型)

```
$feedCard = new FeedCard([
    "links" => [
        [
            "title" => "时代的火车向前开",
            "messageURL" => "https://mp.weixin.qq.com/s?__biz=MzA4NjMwMTA2Ng==&mid=2650316842&idx=1&sn=60da3ea2b29f1dcc43a7c8e4a7c97a16&scene=2&srcid=09189AnRJEdIiWVaKltFzNTw&from=timeline&isappinstalled=0&key=&ascene=2&uin=&devicetype=android-23&version=26031933&nettype=WIFI",
            "picURL" => "https://www.dingtalk.com/"
        ],
        [
            "title" => "时代的火车向前开2",
            "messageURL" => "https://mp.weixin.qq.com/s?__biz=MzA4NjMwMTA2Ng==&mid=2650316842&idx=1&sn=60da3ea2b29f1dcc43a7c8e4a7c97a16&scene=2&srcid=09189AnRJEdIiWVaKltFzNTw&from=timeline&isappinstalled=0&key=&ascene=2&uin=&devicetype=android-23&version=26031933&nettype=WIFI",
            "picURL" => "https://www.dingtalk.com/"
        ]
    ]
]);

$result = $notice->send($feedCard);
```

扫码登录第三方Web网站
------------

[](#扫码登录第三方web网站)

```
/**
 * @param $url 需自行编码
 * @return string 单独页面扫码方式打开的地址
 */
$dingtalk->socialite('config.socialite.name')->getRedirectUrl($url);
```

### 通过 code 获取用户信息

[](#通过-code-获取用户信息)

```
/**
 * @param $code 前台获取的 code
 * @return array|string 用户的信息
*/
$dingtalk->socialite('config.socialite.name')->getUserInfo($code);
```

智能人事
----

[](#智能人事)

### 所有在职员工的 id

[](#所有在职员工的-id)

```
$dingtalk->employee()->all();
```

消息通知
----

[](#消息通知)

### 发送工作通知消息

[](#发送工作通知消息)

```
$dingtalk->microapp()->send();
// todo 未完善
$dingtalk->microapp()->to()->send();
```

通讯录
---

[](#通讯录)

### 用户管理

[](#用户管理)

```
// 获取用户信息
$dingtalk->user()->getUserInfo($userId);
```

### 部门管理

[](#部门管理)

```
// 所有部门，会递归子部门
$dingtalk->department()->all()
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2828d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/72f9a53e815a82dcedc10a1e865bc34defeed186b7a0b931d67885d6b6b251b5?d=identicon)[draguo](/maintainers/draguo)

---

Top Contributors

[![draguo](https://avatars.githubusercontent.com/u/12272760?v=4)](https://github.com/draguo "draguo (14 commits)")

### Embed Badge

![Health badge](/badges/draguo-dingtalk/health.svg)

```
[![Health](https://phpackages.com/badges/draguo-dingtalk/health.svg)](https://phpackages.com/packages/draguo-dingtalk)
```

###  Alternatives

[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[dhlparcel/magento2-plugin

DHL Parcel plugin for Magento 2

11180.5k2](/packages/dhlparcel-magento2-plugin)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
