PHPackages                             ljguo-latex/dingtalk-robot - 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. [API Development](/categories/api)
4. /
5. ljguo-latex/dingtalk-robot

ActiveLibrary[API Development](/categories/api)

ljguo-latex/dingtalk-robot
==========================

DingTalk (钉钉) Robot SDK for PHP — fluent API, all message types, signature support

v1.0.0(2mo ago)04MITPHP &gt;=8.0

Since May 8Compare

[ Source](https://github.com/ljguo-latex/dingtalk-robot)[ Packagist](https://packagist.org/packages/ljguo-latex/dingtalk-robot)[ RSS](/packages/ljguo-latex-dingtalk-robot/feed)WikiDiscussions Synced 3w ago

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

DingTalk Robot SDK
==================

[](#dingtalk-robot-sdk)

钉钉自定义机器人 PHP SDK，支持全部消息类型和加签安全模式。

安装
--

[](#安装)

```
composer require ljguo-latex/dingtalk-robot
```

快速开始
----

[](#快速开始)

```
use DingTalk\Robot;

$robot = new Robot('ACCESS_TOKEN', 'SECRET'); // SECRET 可省略（不启用加签）
```

消息类型
----

[](#消息类型)

### 文本消息

[](#文本消息)

```
$robot->text('服务器 CPU 超过 90%')
      ->at(['138xxxxxxxx'])   // @指定手机号
      ->send();

$robot->text('紧急通知')->atAll()->send(); // @全体
```

### Markdown 消息

[](#markdown-消息)

```
$robot->markdown('上线通知', "## v1.2.0 已上线\n- 修复登录 bug\n- 新增导出功能")
      ->at(['138xxxxxxxx'])
      ->send();
```

### Link 消息

[](#link-消息)

```
$robot->link('每日周报', '本周精选文章，点击查看', 'https://example.com/weekly', 'https://example.com/cover.jpg')
      ->send();
```

### ActionCard — 单按钮

[](#actioncard--单按钮)

```
$robot->actionCard('请假审批', '张三申请 2026-05-08 ~ 05-10 请假')
      ->single('去审批', 'https://example.com/approve/123')
      ->send();
```

### ActionCard — 多按钮

[](#actioncard--多按钮)

```
$robot->actionCard('代码审查', '## PR #88\n新增支付模块')
      ->addButton('合并', 'https://example.com/pr/88/merge')
      ->addButton('拒绝', 'https://example.com/pr/88/reject')
      ->horizontal()  // 横排，默认竖排
      ->send();
```

### FeedCard — 多图文

[](#feedcard--多图文)

```
$robot->feedCard()
      ->addLink('Go 1.22 新特性', 'https://example.com/go122', 'https://example.com/go.png')
      ->addLink('PHP 8.4 发布',   'https://example.com/php84', 'https://example.com/php.png')
      ->send();
```

获取 Token 和 Secret
-----------------

[](#获取-token-和-secret)

钉钉群 → 群设置 → 智能群助手 → 添加机器人 → 自定义机器人
安全设置选「**加签**」，复制 Webhook URL 中的 `access_token` 和显示的 `Secret`（以 `SEC` 开头）。

错误处理
----

[](#错误处理)

```
use DingTalk\Exception\DingTalkException;

try {
    $robot->text('Hello')->send();
} catch (DingTalkException $e) {
    echo $e->getMessage();
}
```

环境要求
----

[](#环境要求)

- PHP &gt;= 8.0
- ext-curl
- ext-json

License
-------

[](#license)

MIT

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance85

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

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

78d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/196161623?v=4)[ljguo](/maintainers/ljguo-latex)[@ljguo-latex](https://github.com/ljguo-latex)

---

Tags

sdkwebhookdingtalkrobot

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ljguo-latex-dingtalk-robot/health.svg)

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

PHPackages © 2026

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