PHPackages                             kanin/workwx - 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. kanin/workwx

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

kanin/workwx
============

workwx sdk

v1.0.0(6y ago)19mitPHPPHP ^7.2

Since Oct 18Pushed 6y ago1 watchersCompare

[ Source](https://github.com/tangccy/workwx)[ Packagist](https://packagist.org/packages/kanin/workwx)[ RSS](/packages/kanin-workwx/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

企业微信SDK
=======

[](#企业微信sdk)

##### 配置

[](#配置)

```
$corpid = '';//企业id
$secret = '';//企业应用秘钥
$contact_secret = '';//通讯录秘钥
$agentId ='';//企业应用id
```

#### 生成扫码地址

[](#生成扫码地址)

```
try {
    $url = \sdf\workwx\WorkWxClient::initialize($corpid, $secret, $agentId)
        ->qrLoginClient()
        ->setRedirectUri('http://workwx.com/test/rec.php')
        ->getUrl();
    header("location:".$url);
} catch (WorkWxExcetion $exception) {
    var_dump($exception->getMessage());
} catch (\Exception $exception) {
    var_dump($exception->getMessage());
}
```

##### 获取access\_token 和 获取登录用户资料

[](#获取access_token-和-获取登录用户资料)

```
try {
    $client = \sdf\workwx\WorkWxClient::initialize($corpid, $secret, $agentId);
    $token = $client->userClientInit()->getAccessToken();
    $code = $_GET['code'];
    $data = $client->userClientInit()->getUserInfo($token, $code);
    var_dump($data);
} catch (WorkWxExcetion $exception) {
    var_dump($exception->getMessage());
} catch (\Exception $exception) {
    var_dump($exception->getMessage());
}
```

##### 获取通讯录的部门列表

[](#获取通讯录的部门列表)

```
try {
    $client = \sdf\workwx\WorkWxClient::initialize($corpid, $contact_secret, $agentId)->departmentClient();
    $token = $client->getAccessToken();
    $data = $client->getDepartment($token);
    var_dump($data);
} catch (WorkWxExcetion $exception) {
    var_dump($exception->getMessage());
} catch (\Exception $exception) {
    var_dump($exception->getMessage());
}
```

##### 获取通讯录的部门用户列表

[](#获取通讯录的部门用户列表)

```
try {

    $client = \sdf\workwx\WorkWxClient::initialize($corpid, $contact_secret, $agentId)->departmentClient();

    $token = $client->getAccessToken();

    //获取详细的列表
    $data = $client->getUserList($token);

    //获取简单列表
    $data = $client->getSimpleUserList($token);

} catch (WorkWxExcetion $exception) {
    var_dump($exception->getMessage());
} catch (\Exception $exception) {
    var_dump($exception->getMessage());
}
```

##### 发送应用文本消息

[](#发送应用文本消息)

```
try {
    $userId = "DaBai";
    $client = \sdf\workwx\WorkWxClient::initialize($corpid, $secret, $agentId)->messageClient();
    $token = $client->getAccessToken();
    $text = "@你的大白 你的快递已到，请携带工卡前往邮件中心领取。出发前可查看邮件中心视频实况，聪明避开排队。";
    $data = $client->sendText($token, $userId, $text);
    print_r($data);
} catch (WorkWxExcetion $exception) {
    var_dump($exception->getMessage());
} catch (\Exception $exception) {
    var_dump($exception->getMessage());
}
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

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

Unknown

Total

1

Last Release

2401d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7269a5ccf967c0f029f2c93c67081c47216a53bd4564f0cf5d6a2ca5f6778b48?d=identicon)[Kanin](/maintainers/Kanin)

---

Top Contributors

[![tangccy](https://avatars.githubusercontent.com/u/12172453?v=4)](https://github.com/tangccy "tangccy (13 commits)")

### Embed Badge

![Health badge](/badges/kanin-workwx/health.svg)

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

###  Alternatives

[rymanalu/factory-generator

Laravel 5 Model Factory Generator.

178.0k](/packages/rymanalu-factory-generator)

PHPackages © 2026

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