{"id":13427703,"url":"https://github.com/wowiwj/ding-notice","last_synced_at":"2026-01-11T16:45:58.930Z","repository":{"id":56480194,"uuid":"134385658","full_name":"wowiwj/ding-notice","owner":"wowiwj","description":"钉钉推送机器人消息发送laravel扩展包","archived":false,"fork":false,"pushed_at":"2020-11-05T01:32:08.000Z","size":36,"stargazers_count":192,"open_issues_count":1,"forks_count":22,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-09-15T17:46:16.058Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wowiwj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-22T08:37:53.000Z","updated_at":"2024-04-22T05:44:22.000Z","dependencies_parsed_at":"2022-08-15T19:31:22.192Z","dependency_job_id":null,"html_url":"https://github.com/wowiwj/ding-notice","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wowiwj%2Fding-notice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wowiwj%2Fding-notice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wowiwj%2Fding-notice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wowiwj%2Fding-notice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wowiwj","download_url":"https://codeload.github.com/wowiwj/ding-notice/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221631810,"owners_count":16855012,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T01:00:38.752Z","updated_at":"2026-01-11T16:45:58.861Z","avatar_url":"https://github.com/wowiwj.png","language":"PHP","funding_links":[],"categories":["开发库和SDK","配置 Configuration","第三方API( Third Party APIs )"],"sub_categories":["PHP","第三方api Third Party APIs"],"readme":"# 钉钉推送机器人消息发送laravel扩展包\n\n[![Build Status](https://travis-ci.org/wowiwj/ding-notice.svg?branch=master)](https://travis-ci.org/wowiwj/ding-notice)\n[![Latest Stable Version](https://poser.pugx.org/wangju/ding-notice/v/stable)](https://packagist.org/packages/wangju/ding-notice)\n[![Total Downloads](https://poser.pugx.org/wangju/ding-notice/downloads)](https://packagist.org/packages/wangju/ding-notice)\n[![Latest Unstable Version](https://poser.pugx.org/wangju/ding-notice/v/unstable)](https://packagist.org/packages/wangju/ding-notice)\n[![License](https://poser.pugx.org/wangju/ding-notice/license)](https://packagist.org/packages/wangju/ding-notice)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/wowiwj/ding-notice/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/wowiwj/ding-notice/?branch=master)\n[![Code Intelligence Status](https://scrutinizer-ci.com/g/wowiwj/ding-notice/badges/code-intelligence.svg?b=master)](https://scrutinizer-ci.com/code-intelligence)\n[![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://github.com/ellerbrock/open-source-badge/)   \n\n\n### 请先阅读 [钉钉官方文档](https://open-doc.dingtalk.com/microapp/serverapi2/qf2nxq)\n\n\n# 介绍\nding-notie 是一款钉钉机器人消息发送的Laravel扩展，您可以通过此扩展便捷的发送钉钉消息，进行监控和提醒操作\n\n# 要求\n- php版本:\u003e=7.0\n- laravel版本: Laravel5.5+\n\n\n# 安装\n\n```php\ncomposer require wangju/ding-notice\n\n```\n\n# 在非laravel项目中使用\n```php\n$ding = new \\DingNotice\\DingTalk([\n    \"default\" =\u003e [\n        'enabled' =\u003e true,\n        'token' =\u003e \"you-push-token\",\n        'timeout' =\u003e 2.0,\n        'ssl_verify' =\u003e true,\n        'secret' =\u003e '',\n    ]\n]);\n\n$ding-\u003etext('我就是我, xxx 是不一样的烟火');\n```\n\n# 在laravel项目中使用\n\n安装成功后执行\n```php\nphp artisan vendor:publish --provider=\"DingNotice\\DingNoticeServiceProvider\"\n\n```\n会自动将`ding.php`添加到您项目的配置文件当中\n\n# 相关配置\n\n### 钉钉启用开关\n(可选)默认为开启\n```php\nDING_ENABLED=true\n```\n### 钉钉的推送token\n- (必选)发送钉钉机器人的token，即在您创建机器人之后的access_token\n- 钉钉推送链接:https://oapi.dingtalk.com/robot/send?access_token=you-push-token\n```php\nDING_TOKEN=you-push-token\n```\n\n\n### 多机器人配置\n如果想要添加多个机器人，则在`ding.php`当中添加机器人名字和相关的配置即可\n\n```php\nreturn [\n\n    'default' =\u003e [\n        'enabled' =\u003e env('DING_ENABLED',true),\n\n        'token' =\u003e env('DING_TOKEN',''),\n\n        'timeout' =\u003e env('DING_TIME_OUT',2.0),\n        \n        'ssl_verify' =\u003e env('DING_SSL_VERIFY',true),\n        \n        'secret' =\u003e env('DING_SECRET',true), \n    ],\n\n    'other' =\u003e [\n        'enabled' =\u003e env('OTHER_DING_ENABLED',true),\n\n        'token' =\u003e env('OTHER_DING_TOKEN',''),\n\n        'timeout' =\u003e env('OTHER_DING_TIME_OUT',2.0),\n        \n        'ssl_verify' =\u003e env('DING_SSL_VERIFY',true),\n        \n        'secret' =\u003e env('OTHER_DING_SECRET',true), \n    ]\n\n];\n```\n\n\n### 钉钉发送的超时时间\n- (可选) 默认为2.0秒\n```php\nDING_TIME_OUT=\n```\n\n### 是否开启SSL验证\n\n- (可选)默认为开启，关闭请手动设置\n```php\nDING_SSL_VERIFY=false\n```\n### 开启钉钉安全配置\n\n- (可选)默认为无\n```php\nDING_SECRET=\n```\n\n\n# 使用\n\n## 发送纯文字消息\n```php\nding('我就是我, xxx 是不一样的烟火')\n```\nor\n```php\nding()-\u003etext('我就是我, xxx 是不一样的烟火')\n```\n发送过程@其他人或者所有人\n\n```php\nding()-\u003eat([\"13888888888\"],true)\n      -\u003etext(\"我就是我,@13888888888 是不一样的烟火\")\n```\n\n## 发送链接类型的消息\n\n\n```php\n \n$title = \"自定义机器人协议\";\n$text = \"群机器人是钉钉群的高级扩展功能。群机器人可以将第三方服务的信息聚合到群聊中，实现自动化的信息同步。例如：通过聚合GitHub，GitLab等源码管理服务，实现源码更新同步；通过聚合Trello，JIRA等项目协调服务，实现项目信息同步。不仅如此，群机器人支持Webhook协议的自定义接入，支持更多可能性，例如：你可将运维报警提醒通过自定义机器人聚合到钉钉群。\";\n$picUrl = \"\";\n$messageUrl = \"https://open-doc.dingtalk.com/docs/doc.htm?spm=a219a.7629140.0.0.Rqyvqo\u0026treeId=257\u0026articleId=105735\u0026docType=1\";\n\nding()-\u003elink($title,$text,$messageUrl,$picUrl)\n```\n\n## 发送markdown类型的消息\n\n```php\n$title = '杭州天气';\n$markdown = \"#### 杭州天气  \\n \".\n            \"\u003e 9度，@1825718XXXX 西北风1级，空气良89，相对温度73%\\n\\n \".\n            \"\u003e ![screenshot](http://i01.lw.aliimg.com/media/lALPBbCc1ZhJGIvNAkzNBLA_1200_588.png)\\n\".\n            \"\u003e ###### 10点20分发布 [天气](http://www.thinkpage.cn/) \";\n            \nding()-\u003emarkdown($title,$markdown);\n```\nor\n\n```php                                        \nding()-\u003eat([],true)\n    -\u003emarkdown($title,$markdown)\n```\n\n## 发送Action类型的消息\n\n### 发送single类型的消息\n```php\n$title = \"乔布斯 20 年前想打造一间苹果咖啡厅，而它正是 Apple Store 的前身\";\n$text = \"![screenshot](@lADOpwk3K80C0M0FoA) \\n\".\n    \" #### 乔布斯 20 年前想打造的苹果咖啡厅 \\n\\n\".\n    \" Apple Store 的设计正从原来满满的科技感走向生活化，而其生活化的走向其实可以追溯到 20 年前苹果一个建立咖啡馆的计划\";\n\nding()-\u003eactionCard($title,$text,1)\n    -\u003esingle(\"阅读全文\",\"https://www.dingtalk.com/\")\n    -\u003esend()\n```\n### 发送btns类型的消息\n\n```php\nding()-\u003eactionCard($title,$text,1)\n    -\u003eaddButtons(\"内容不错\",\"https://www.dingtalk.com/\")\n    -\u003eaddButtons(\"不感兴趣\",\"https://www.dingtalk.com/\")\n    -\u003esend();\n```\n\n## 发送Feed类型的消息\n\n```php\n$messageUrl = \"https://mp.weixin.qq.com/s?__biz=MzA4NjMwMTA2Ng==\u0026mid=2650316842\u0026idx=1\u0026sn=60da3ea2b29f1dcc43a7c8e4a7c97a16\u0026scene=2\u0026srcid=09189AnRJEdIiWVaKltFzNTw\u0026from=timeline\u0026isappinstalled=0\u0026key=\u0026ascene=2\u0026uin=\u0026devicetype=android-23\u0026version=26031933\u0026nettype=WIFI\";\n$picUrl = \"https://www.dingtalk.com\";\nding()-\u003efeed()\n    -\u003eaddLinks('时代的火车向前开',$messageUrl,$picUrl)\n    -\u003eaddLinks('时代的火车向前开2',$messageUrl,$picUrl)\n    -\u003esend();\n```\n## 多机器人消息发送\n\n### 发送纯文字消息\n```php\nding('我就是我, xxx 是不一样的烟火','other')\n```\nor\n```php\nding()-\u003ewith('other')-\u003etext('我就是我, xxx 是不一样的烟火');\n```\n\n### 通过其他机器人发送其他类型消息\n```php\nding()-\u003ewith('other')-\u003emarkdown($title,$markdown);\n\nding()-\u003ewith('other')\n       -\u003efeed()\n       -\u003eaddLinks('时代的火车向前开',$messageUrl,$picUrl)\n       -\u003eaddLinks('时代的火车向前开2',$messageUrl,$picUrl)\n       -\u003esend();\n```\nenjoy :)\n\n\n- 效果\n![file](https://lccdn.phphub.org/uploads/images/201805/23/6932/q3nLCOPbRj.png?imageView2/2/w/1240/h/0)\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwowiwj%2Fding-notice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwowiwj%2Fding-notice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwowiwj%2Fding-notice/lists"}