PHPackages                             cdcchen/yii2-wechat - 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. cdcchen/yii2-wechat

ActiveYii2-extension[API Development](/categories/api)

cdcchen/yii2-wechat
===================

yii2 wechat component

2.0.10(10y ago)12241BSD-4-ClausePHPPHP &gt;=5.4.0

Since Apr 28Pushed 9y ago1 watchersCompare

[ Source](https://github.com/cdcchen/yii2-wechat)[ Packagist](https://packagist.org/packages/cdcchen/yii2-wechat)[ Docs](https://github.com/cdcchen/yii2-wechat)[ RSS](/packages/cdcchen-yii2-wechat/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (18)Used By (0)

yii2-wechat 组件使用说明
==================

[](#yii2-wechat-组件使用说明)

### [1.x 文档请移步到此 &gt;&gt;&gt;](//github.com/cdcchen/yii2-wechat/wiki/1.x-%E6%96%87%E6%A1%A3%E8%AF%B7%E7%A7%BB%E6%AD%A5%E5%88%B0%E6%AD%A4----)

[](#1x-文档请移步到此-)

第一步：在components中加入组件配置：
-----------------------

[](#第一步在components中加入组件配置)

```
'qyWechat' => [
    'class' => 'cdcchen\yii\wechat\QyClient',
    'cache' => 'cache',
]
```

> 注：cache属性为必需项。

第二步：在action代码中调用：
-----------------

[](#第二步在action代码中调用)

```
/* @var \cdcchen\yii\wechat\QyClient $wechat */
$wechat = Yii::$app->get('qyWechat');
```

获取【主动消息接口的 Access Token】

```
/* @var \cdcchen\yii\wechat\Token $token */
$token = $wechat->getDefaultToken($corpId, $secret);
```

获取【获取应用提供商凭证 Access Token】

```
/* @var \cdcchen\yii\wechat\Token $token */
$token = $wechat->getProviderToken($corpId, $secret);
```

$token 的类型为 \\cdcchen\\yii\\wechat\\Token：

```
cdcchen\yii\wechat\Token Object
(
    [cropId] => wx4affdfc26d62c294
    [value] => w2M2f2Tj4_-sGHrAv_kdi1__f61exwPUCnvvoJFQ0MPczYttF-22gZuYhV5GHQou
    [expire] => 7200
    [createdAt] => 1462331430
)
```

第三步：调用具体接口
----------

[](#第三步调用具体接口)

以获取微信回调服务器IP列表为例：

```
use cdcchen\wechat\qy\ServerClient;
$client = new ServerClient($accessToken);
$data = $client->getCallbackIP();
```

###  Health Score

30

—

LowBetter than 65% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity67

Established project with proven stability

 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 ~0 days

Total

15

Last Release

3663d ago

Major Versions

1.0.4 → 2.0.12016-04-28

### Community

Maintainers

![](https://www.gravatar.com/avatar/e0d05ba8b4e28f787a22322fdf0e3f0888231997cf6adc4ee5d187dee7bddf19?d=identicon)[cdcchen](/maintainers/cdcchen)

---

Top Contributors

[![cdcchen](https://avatars.githubusercontent.com/u/748891?v=4)](https://github.com/cdcchen "cdcchen (25 commits)")

---

Tags

yii2-wechatyii2 weixinyii2 wechat extensionyii2 weixin extensionqy weixin extensionqy wechat extension

### Embed Badge

![Health badge](/badges/cdcchen-yii2-wechat/health.svg)

```
[![Health](https://phpackages.com/badges/cdcchen-yii2-wechat/health.svg)](https://phpackages.com/packages/cdcchen-yii2-wechat)
```

###  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.8M187](/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.1M452](/packages/google-gax)

PHPackages © 2026

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