PHPackages                             jmiy/hyperf-ding-notice-3-1 - 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. jmiy/hyperf-ding-notice-3-1

ActiveLibrary

jmiy/hyperf-ding-notice-3-1
===========================

a dingtalk robot message handle for send message

0236↓100%PHP

Since Mar 5Pushed 2w ago1 watchersCompare

[ Source](https://github.com/Jmiy/hyperf-ding-notice-3-1)[ Packagist](https://packagist.org/packages/jmiy/hyperf-ding-notice-3-1)[ RSS](/packages/jmiy-hyperf-ding-notice-3-1/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

钉钉推送机器人消息发送Hyperf扩展包
====================

[](#钉钉推送机器人消息发送hyperf扩展包)

[![Build Status](https://camo.githubusercontent.com/277f3510aa419eeb5130de9f68ca60bb0f9aea03b83e1a6b3cf8eb475849ae4f/68747470733a2f2f7472617669732d63692e6f72672f776f7769776a2f64696e672d6e6f746963652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/wowiwj/ding-notice)[![Latest Stable Version](https://camo.githubusercontent.com/91dcfb59e8daf798d7c98710b64b55033a76d851bf015d85c2036931837590c1/68747470733a2f2f706f7365722e707567782e6f72672f77616e676a752f64696e672d6e6f746963652f762f737461626c65)](https://packagist.org/packages/jmiy/hyperf-ding-notice)[![Total Downloads](https://camo.githubusercontent.com/6a38708d15c65010ed588fbcacdd3d76c2bbaf42d5529aad1e734492c309b670/68747470733a2f2f706f7365722e707567782e6f72672f77616e676a752f64696e672d6e6f746963652f646f776e6c6f616473)](https://packagist.org/packages/jmiy/hyperf-ding-notice)[![Latest Unstable Version](https://camo.githubusercontent.com/340f3767b6ec9a549cf6b7c83fb83892d76b24e6e967fca7b8bfc5f5f532cf9f/68747470733a2f2f706f7365722e707567782e6f72672f77616e676a752f64696e672d6e6f746963652f762f756e737461626c65)](https://packagist.org/packages/jmiy/hyperf-ding-notice)[![License](https://camo.githubusercontent.com/9784608da4950634dfd375015df7ca58b6adfe5118c33bbff8ee5ba519aa74c4/68747470733a2f2f706f7365722e707567782e6f72672f77616e676a752f64696e672d6e6f746963652f6c6963656e7365)](https://packagist.org/packages/jmiy/hyperf-ding-notice)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/1ed3b21e90796894a4cb7500ef5e02fabf6e51534a870605065f6911abb31c69/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f776f7769776a2f64696e672d6e6f746963652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/wowiwj/ding-notice/?branch=master)[![Code Intelligence Status](https://camo.githubusercontent.com/91ec9e14cba2dc1d9a8f615dd7b3b2af0600eeb2b9a54f46a9ab3786a1ff4b38/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f776f7769776a2f64696e672d6e6f746963652f6261646765732f636f64652d696e74656c6c6967656e63652e7376673f623d6d6173746572)](https://scrutinizer-ci.com/code-intelligence)[![Open Source Love](https://camo.githubusercontent.com/a8a6219cf0313b681948382bcbcc27a34ae00572d463437bd92ebb1df58647c9/68747470733a2f2f6261646765732e66726170736f66742e636f6d2f6f732f76312f6f70656e2d736f757263652e7376673f763d313033)](https://github.com/ellerbrock/open-source-badge/)

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

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

介绍
==

[](#介绍)

ding-notie 是一款钉钉机器人消息发送的Hyperf扩展，您可以通过此扩展便捷的发送钉钉消息，进行监控和提醒操作

要求
==

[](#要求)

- php版本:&gt;=7.0
- Hyperf版本: Hyperf 2.1+

安装
==

[](#安装)

```
composer require jmiy/hyperf-ding-notice-3-1
```

在非Hyperf项目中使用
=============

[](#在非hyperf项目中使用)

```
$ding = new \DingNotice\DingTalk([
    "default" => [
        'enabled' => true,
        'token' => "you-push-token",
        'timeout' => 2.0,
        'ssl_verify' => true,
        'secret' => '',
    ]
]);

$ding->text('我就是我, xxx 是不一样的烟火');
```

在Hyperf项目中使用
============

[](#在hyperf项目中使用)

安装成功后执行

```
php bin/hyperf.php vendor:publish jmiy/hyperf-ding-notice-3-1
```

会自动将`ding.php`添加到您项目的配置文件当中

相关配置
====

[](#相关配置)

### 钉钉启用开关

[](#钉钉启用开关)

(可选)默认为开启

```
DING_ENABLED=true
```

### 钉钉的推送token

[](#钉钉的推送token)

- (必选)发送钉钉机器人的token，即在您创建机器人之后的access\_token
- 钉钉推送链接:[https://oapi.dingtalk.com/robot/send?access\_token=you-push-token](https://oapi.dingtalk.com/robot/send?access_token=you-push-token)

```
DING_TOKEN=you-push-token
```

### 多机器人配置

[](#多机器人配置)

如果想要添加多个机器人，则在`ding.php`当中添加机器人名字和相关的配置即可

```
use function Hyperf\Support\env;
return [

    // 默认发送的机器人

    'default' => [
        // 是否要开启机器人，关闭则不再发送消息
        'enabled' => env('DING_ENABLED',true),
        // 机器人的access_token
        'token' => env('DING_TOKEN',''),
        // 钉钉请求的超时时间
        'timeout' => env('DING_TIME_OUT',2.0),
        // 是否开启ss认证
        'ssl_verify' => env('DING_SSL_VERIFY',true),
        // 开启安全配置
        'secret' => env('DING_SECRET',true),
    ],

    'other' => [
        'enabled' => env('OTHER_DING_ENABLED',true),

        'token' => env('OTHER_DING_TOKEN',''),

        'timeout' => env('OTHER_DING_TIME_OUT',2.0),

        'ssl_verify' => env('DING_SSL_VERIFY',true),

        'secret' => env('DING_SECRET',true),
    ]
];
```

### 钉钉发送的超时时间

[](#钉钉发送的超时时间)

- (可选) 默认为2.0秒

```
DING_TIME_OUT=
```

### 是否开启SSL验证

[](#是否开启ssl验证)

- (可选)默认为开启，关闭请手动设置

```
DING_SSL_VERIFY=false
```

### 开启钉钉安全配置

[](#开启钉钉安全配置)

- (可选)默认为无

```
DING_SECRET=
```

使用
==

[](#使用)

发送纯文字消息
-------

[](#发送纯文字消息)

```
ding('我就是我, xxx 是不一样的烟火')
```

or

```
ding()->text('我就是我, xxx 是不一样的烟火')
```

发送过程@其他人或者所有人

```
ding()->at(["13888888888"],true)
      ->text("我就是我,@13888888888 是不一样的烟火")
```

发送链接类型的消息
---------

[](#发送链接类型的消息)

```

$title = "自定义机器人协议";
$text = "群机器人是钉钉群的高级扩展功能。群机器人可以将第三方服务的信息聚合到群聊中，实现自动化的信息同步。例如：通过聚合GitHub，GitLab等源码管理服务，实现源码更新同步；通过聚合Trello，JIRA等项目协调服务，实现项目信息同步。不仅如此，群机器人支持Webhook协议的自定义接入，支持更多可能性，例如：你可将运维报警提醒通过自定义机器人聚合到钉钉群。";
$picUrl = "";
$messageUrl = "https://open-doc.dingtalk.com/docs/doc.htm?spm=a219a.7629140.0.0.Rqyvqo&treeId=257&articleId=105735&docType=1";

ding()->link($title,$text,$messageUrl,$picUrl)
```

发送markdown类型的消息
---------------

[](#发送markdown类型的消息)

```
$title = '杭州天气';
$markdown = "#### 杭州天气  \n ".
            "> 9度，@1825718XXXX 西北风1级，空气良89，相对温度73%\n\n ".
            "> ![screenshot](http://i01.lw.aliimg.com/media/lALPBbCc1ZhJGIvNAkzNBLA_1200_588.png)\n".
            "> ###### 10点20分发布 [天气](http://www.thinkpage.cn/) ";

ding()->markdown($title,$markdown);
```

or

```
ding()->at([],true)
    ->markdown($title,$markdown)
```

发送Action类型的消息
-------------

[](#发送action类型的消息)

### 发送single类型的消息

[](#发送single类型的消息)

```
$title = "乔布斯 20 年前想打造一间苹果咖啡厅，而它正是 Apple Store 的前身";
$text = "![screenshot](@lADOpwk3K80C0M0FoA) \n".
    " #### 乔布斯 20 年前想打造的苹果咖啡厅 \n\n".
    " Apple Store 的设计正从原来满满的科技感走向生活化，而其生活化的走向其实可以追溯到 20 年前苹果一个建立咖啡馆的计划";

ding()->actionCard($title,$text,1)
    ->single("阅读全文","https://www.dingtalk.com/")
    ->send()
```

### 发送btns类型的消息

[](#发送btns类型的消息)

```
ding()->actionCard($title,$text,1)
    ->addButtons("内容不错","https://www.dingtalk.com/")
    ->addButtons("不感兴趣","https://www.dingtalk.com/")
    ->send();
```

发送Feed类型的消息
-----------

[](#发送feed类型的消息)

```
$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";
ding()->feed()
    ->addLinks('时代的火车向前开',$messageUrl,$picUrl)
    ->addLinks('时代的火车向前开2',$messageUrl,$picUrl)
    ->send();
```

多机器人消息发送
--------

[](#多机器人消息发送)

### 发送纯文字消息

[](#发送纯文字消息-1)

```
ding('我就是我, xxx 是不一样的烟火','other')
```

or

```
ding()->with('other')->text('我就是我, xxx 是不一样的烟火');
```

### 通过其他机器人发送其他类型消息

[](#通过其他机器人发送其他类型消息)

```
ding()->with('other')->markdown($title,$markdown);

ding()->with('other')
       ->feed()
       ->addLinks('时代的火车向前开',$messageUrl,$picUrl)
       ->addLinks('时代的火车向前开2',$messageUrl,$picUrl)
       ->send();
```

enjoy :)

- 效果 [![file](https://camo.githubusercontent.com/328573a53e17f81cee70581590ad65d1c7f87bf9170164d295031f1106899a31/68747470733a2f2f6c6363646e2e7068706875622e6f72672f75706c6f6164732f696d616765732f3230313830352f32332f363933322f71336e4c434f5062526a2e706e673f696d61676556696577322f322f772f313234302f682f30)](https://camo.githubusercontent.com/328573a53e17f81cee70581590ad65d1c7f87bf9170164d295031f1106899a31/68747470733a2f2f6c6363646e2e7068706875622e6f72672f75706c6f6164732f696d616765732f3230313830352f32332f363933322f71336e4c434f5062526a2e706e673f696d61676556696577322f322f772f313234302f682f30)

###  Health Score

24

—

LowBetter than 35% of packages

Maintenance63

Regular maintenance activity

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/2726abd8712df0eefd9b931eb46b8679b0076c443e73c925428932d62c853953?d=identicon)[Jmiy](/maintainers/Jmiy)

---

Top Contributors

[![Jmiy](https://avatars.githubusercontent.com/u/72489604?v=4)](https://github.com/Jmiy "Jmiy (6 commits)")

### Embed Badge

![Health badge](/badges/jmiy-hyperf-ding-notice-3-1/health.svg)

```
[![Health](https://phpackages.com/badges/jmiy-hyperf-ding-notice-3-1/health.svg)](https://phpackages.com/packages/jmiy-hyperf-ding-notice-3-1)
```

PHPackages © 2026

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