PHPackages                             errorcode/tim - 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. errorcode/tim

ActiveLibrary

errorcode/tim
=============

php腾讯即时通讯 IM

v1.0.4(5y ago)213MITPHPPHP &gt;=5.4

Since Dec 19Pushed 5y ago1 watchersCompare

[ Source](https://github.com/error-code/tencent-im)[ Packagist](https://packagist.org/packages/errorcode/tim)[ Docs](https://github.com/errorcode/tencent-im)[ RSS](/packages/errorcode-tim/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (2)Versions (6)Used By (0)

说明
--

[](#说明)

php 简单封装 **腾讯即时通讯IM** 服务端，便于自己方便使用

IM版本：v4

composer 安装

```
composer require errorcode\tim

```

#### 1.使用

[](#1使用)

```
$tim = new errorcode\tim\Tim($config);
$config['appid']    必须，腾讯即时通讯获得
$config['key']      必须，腾讯即时通讯获得
$config['userid']    必须，用户名或ID，一般应用管理员

```

###### 初始化后会自动校验和缓存UserSig

[](#初始化后会自动校验和缓存usersig)

#### 2.获取UserSig

[](#2获取usersig)

```
/**
* 获取UserSig
*/
$tim->getSign();

```

##### 临时手动切换账号与UserSig

[](#临时手动切换账号与usersig)

```
// $sign 为已获得的UserSig
$tim->setConfig($userid,$sign);

```

#### 3.使用API

[](#3使用api)

```
// $service 内部服务名
// $command 业务名
// $data 数组 需要传入的参数
$result = $tim->query($service,$command,$data = []);
print_r($result);

```

以数组的形式返回结果

```
//结果示例
[
   "ActionStatus"=>"OK",
   "ErrorInfo"=>"",
   "ErrorCode"=>0
]

```

#### 栗子：

[](#栗子)

> 导入单个帐号 文档参考：

使用方法：

```
$result = $tim->query('im_open_login_svc','account_import',[
    'Identifier'=>'test',
    'Nick'=>'test',
    'FaceUrl'=>'http://www.qq.com'
]);
print_r($result);

```

> 具体业务逻辑与返回数据以官方文档为准 更多使用方法参考官方文档

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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

Every ~7 days

Total

5

Last Release

1947d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a39af2adbfdf5cf3e8e797680058bc4f3013a8f2cc111674dadd808d7219c2c2?d=identicon)[error-code](/maintainers/error-code)

---

Top Contributors

[![error-code](https://avatars.githubusercontent.com/u/19849369?v=4)](https://github.com/error-code "error-code (6 commits)")

---

Tags

imtim

### Embed Badge

![Health badge](/badges/errorcode-tim/health.svg)

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

###  Alternatives

[bogdaan/viber-bot-php

Php bot interface to work with Viber API

238174.0k2](/packages/bogdaan-viber-bot-php)[hedeqiang/ten-im

腾讯云即时通信 SDK for PHP

3617.1k3](/packages/hedeqiang-ten-im)

PHPackages © 2026

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