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. [Utility &amp; Helpers](/categories/utility)
4. /
5. errorcode/tim

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

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 today

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 31% 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

1994d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/19849369?v=4)[errorcode](/maintainers/error-code)[@error-code](https://github.com/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

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k543.5M2.6k](/packages/aws-aws-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k38](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M46](/packages/tencentcloud-tencentcloud-sdk-php)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k43](/packages/civicrm-civicrm-core)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[oat-sa/tao-core

TAO core extension

66143.7k124](/packages/oat-sa-tao-core)

PHPackages © 2026

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