PHPackages                             longdaihai/tencentim - 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. longdaihai/tencentim

ActiveLibrary[API Development](/categories/api)

longdaihai/tencentim
====================

tencentim cloud

02PHP

Since Jan 21Pushed 5y ago1 watchersCompare

[ Source](https://github.com/longdaihai/packagist-tencentim)[ Packagist](https://packagist.org/packages/longdaihai/tencentim)[ RSS](/packages/longdaihai-tencentim/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

腾讯云IM服务端API
===========

[](#腾讯云im服务端api)

php plugin for tencen cloud

安装
--

[](#安装)

```
composer require longdaihai/tencentim:dev-master

```

参考
--

[](#参考)

- 参考钉钉自定义机器人[接口文档](https://open-doc.dingtalk.com/microapp/serverapi2/qf2nxq)

可调用的方法
------

[](#可调用的方法)

```
//实例化
$ding = new \longdaihai\ding\DingBot(['webhook'=>'https://oapi.dingtalk.com/robot/send......']);

//发送文本消息
$res = $ding->text('hello hello');
$res = $ding->at('18759201163')->at('18698313968')->text('hello hello');
$res = $ding->atAll()->text('hello hello');

//发送链接
$res = $ding->link('电子档案平台','建设工程全过程资料无纸化平台','http://www.efileyun.com','http://www.efileyun.com/Public/images/banner_02.png');

//发送markdown
$res = $ding->markdown(
    '电子档案平台',
    "## 电子档案平台 \n **建设工程**全过程资料无纸化[档案平台](http://www.efileyun.com) \n ![宣传图片](http://www.efileyun.com/Public/images/banner_02.png)"
);

//发送actionCard
$res = $ding->singleActionCard('周星驰的龙套生涯','台上一分钟，台下十年功。一点没错。从跑龙套变成星爷','https://v.qq.com/x/page/t09039nicle.html','https://abiko.loli.net/files/2019/07/29/ede7e2b6d13a41ddf9f4bdef84fdc737.png');

//发送actionCard
$res = $ding->makeBtn('周杰伦','http://tags.finance.sina.com.cn/%E5%91%A8%E6%9D%B0%E4%BC%A6')
    ->makeBtn('蔡徐坤','http://tags.finance.sina.com.cn/%E8%94%A1%E5%BE%90%E5%9D%A4')
    ->multiActionCard(
    '微博超话榜',
    "![st](https://p.ssl.qhimg.com/dmsmfl/120_75_/t01699b85fad2bf863d.webp?size=639x400&phash=2584806780411300945)## 微博超话榜 \n在过去前一周里,一群70后、80后、90后的 叔叔阿姨们 ,像打了鸡血一样,为周杰伦发起了一场 打榜之战"
    );

//发送feedCard
$res = $ding->makeLink(
    '这些工种，赚钱多多','https://bh.sb/post/46133/','https://abiko.loli.net/files/2019/07/29/b83aac23b9528732c23cc7352950e880.png')
    ->makeLink('男青年择偶指南','https://bh.sb/post/46123/','https://abiko.loli.net/files/2019/07/28/c8c41c4a18675a74e01c8a20e8a0f662.png')
    ->makeLink('你我所熟知的那个维基百科，出事情了','https://bh.sb/post/46120/','https://abiko.loli.net/thumb/?src=https://dulei.si/files/2019/07/28/006f52e9102a8d3be2fe5614f42ba989.jpeg&w=240&h=180&zc=1')
    ->feedCard();

```

通用使用教程
------

[](#通用使用教程)

### 入口文件

[](#入口文件)

```
require_once './vendor/autoload.php';

```

### 新建一个类继承DingBot

[](#新建一个类继承dingbot)

```
use longdaihai\ding\DingBot;

class Dingding extends DingBot
{
    public function __construct()
    {
        parent::__construct([
            'webhook' => 'https://oapi.dingtalk.com/robot/send?access_token=3707d61374a8c4369ddbeae8eedbf93a1772379dee6d75a8f66951e5fc6a8523'
        ]);
    }
}

```

### 使用

[](#使用)

```
$ding = new Dingding();
$res = $ding->text("1111111111");

```

thinkphp6.0.x 日志配置方法
--------------------

[](#thinkphp60x-日志配置方法)

### config

[](#config)

```
# config/log.php
return [
    // 默认日志记录通道
    'default'      => Env::get('log.channel', 'file'),
    // 日志记录级别
    'level'        => [],
    // 日志类型记录的通道 ['error'=>'email',...]
    'type_channel' => ['error'=>'ding',],
    // 是否关闭日志写入
    'close'        => false,
    // 全局日志处理 支持闭包
    'processor'    => null,

    // 日志通道列表
    'channels'     => [
        'file' => [
            // 日志记录方式
            'type'           => 'File',
            // 日志保存目录
            'path'           => '',
            // 单文件日志写入
            'single'         => false,
            // 独立日志级别
            'apart_level'    => [],
            // 最大日志文件数量
            'max_files'      => 0,
            // 使用JSON格式记录
            'json'           => false,
            // 日志处理
            'processor'      => null,
            // 关闭通道日志写入
            'close'          => false,
            // 日志输出格式化
            'format'         => '[%s][%s] %s',
            // 是否实时写入
            'realtime_write' => false,
        ],
        // 其它日志通道配置
        'ding' => [
            // 日志记录方式
            'type'           => '\\bingher\\ding\\DingLog',
            // 你申请的钉钉机器人api
            'webhook' => 'https://oapi.dingtalk.com/robot/send?access_token=xxxx',
            // @人的手机号
            'at' => [],
        ],
    ],

];

```

> 因为钉钉群机器人每分钟最多20条信息,所以建议将error级别的日志使用钉钉来发送,可以及时收到错误提醒

### 示例

[](#示例)

```
\think\facade\Log::info('有点事情');
\think\facade\Log::notice('有点问题');
\think\facade\Log::error('代志大条了');

```

> 仅error消息会通知到钉钉

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity30

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/804ae296a75915d4b047f34fd0d9b78b809d27416b69ff5ce06de92386c3c9a9?d=identicon)[long164897](/maintainers/long164897)

---

Top Contributors

[![longdaihai](https://avatars.githubusercontent.com/u/24327040?v=4)](https://github.com/longdaihai "longdaihai (3 commits)")

### Embed Badge

![Health badge](/badges/longdaihai-tencentim/health.svg)

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M475](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M186](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M451](/packages/google-gax)

PHPackages © 2026

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