PHPackages                             abei2017/yii2-wx - 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. abei2017/yii2-wx

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

abei2017/yii2-wx
================

一个专注于yii2的微信sdk

1.3.6(5y ago)1482.8k53[2 issues](https://github.com/abei2017/yii2-wx/issues)[1 PRs](https://github.com/abei2017/yii2-wx/pulls)MITPHPPHP &gt;=5.4

Since Feb 22Pushed 5y ago10 watchersCompare

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

READMEChangelog (10)Dependencies (2)Versions (13)Used By (0)

 [ ![yii2-wx Logo](https://camo.githubusercontent.com/1705ee9d9e81436d164e84154d9de78b38c777436a88c5031b47da39c452790a/68747470733a2f2f6e6169382e6d652f75706c6f6164732f6170702f323032302f313132372f31383133416e5f67374f6c596f556f5370546d427556592d553838725f3178422d313630363432393433372e706e67) ](https://nai8.me/app-2.html)

 一款服务于yii2的微信SDK（公众号、小程序、开放平台和企业微信）

 [![](https://camo.githubusercontent.com/a75b31fd99b1ea5eb204576efcb0bb9dafe7a37ef3fe2455d079df7299297585/68747470733a2f2f706f7365722e707567782e6f72672f61626569323031372f796969322d77782f762f737461626c65)](https://camo.githubusercontent.com/a75b31fd99b1ea5eb204576efcb0bb9dafe7a37ef3fe2455d079df7299297585/68747470733a2f2f706f7365722e707567782e6f72672f61626569323031372f796969322d77782f762f737461626c65) [![](https://camo.githubusercontent.com/94c9ca7b37a1452b4135780cea7289a8eeb073f6af0bf7834f6b5329588e08a2/68747470733a2f2f706f7365722e707567782e6f72672f61626569323031372f796969322d77782f646f776e6c6f616473)](https://camo.githubusercontent.com/94c9ca7b37a1452b4135780cea7289a8eeb073f6af0bf7834f6b5329588e08a2/68747470733a2f2f706f7365722e707567782e6f72672f61626569323031372f796969322d77782f646f776e6c6f616473) [![](https://camo.githubusercontent.com/378f6d96c4512aed6db1434aeda3f5fd24144bfa6cff6a37d6b18fa0fce9566e/68747470733a2f2f706f7365722e707567782e6f72672f61626569323031372f796969322d77782f762f756e737461626c65)](https://camo.githubusercontent.com/378f6d96c4512aed6db1434aeda3f5fd24144bfa6cff6a37d6b18fa0fce9566e/68747470733a2f2f706f7365722e707567782e6f72672f61626569323031372f796969322d77782f762f756e737461626c65) [![](https://camo.githubusercontent.com/dbd5e3fa39435839a8869f4051e597f63be059ba59fffa38457bd0f94be39a1c/68747470733a2f2f706f7365722e707567782e6f72672f61626569323031372f796969322d77782f6c6963656e7365)](https://camo.githubusercontent.com/dbd5e3fa39435839a8869f4051e597f63be059ba59fffa38457bd0f94be39a1c/68747470733a2f2f706f7365722e707567782e6f72672f61626569323031372f796969322d77782f6c6963656e7365)

---

文档
--

[](#文档)

- [中文文档](https://nai8.me/app/book_detail.html?id=8)

业务的实现方案以及生态
-----------

[](#业务的实现方案以及生态)

- [使用yii2-wx轻松实现PC端用微信扫描小程序码直接登录功能](https://nai8.me/app/book_item.html?id=116)

系统需求（Requirement）
-----------------

[](#系统需求requirement)

- PHP &gt;= 5.4
- Composer
- openssl
- fileinfo

安装（Installation）
----------------

[](#安装installation)

```
$ composer require "abei2017/yii2-wx" -vvv
```

配置（set）
-------

[](#配置set)

配置参数建议存放到yii2的配置文件中，例如基础版yii2可以如下配置

```
return [
    'wx'=>[
        //  公众号信息
        'mp'=>[
            //  账号基本信息
            'app_id'  => '', // 公众号的appid
            'secret'  => '', // 公众号的秘钥
            'token'   => '', // 接口的token
            'encodingAESKey'=>'',
            'safeMode'=>0,

            //  微信支付
            'payment'=>[
                'mch_id'        =>  '',// 商户ID
                'key'           =>  '',// 商户KEY
                'notify_url'    =>  '',// 支付通知地址
                'cert_path'     => '',// 证书
                'key_path'      => '',// 证书
            ],

            // web授权
            'oauth' => [
                'scopes'   => 'snsapi_userinfo',// 授权范围
                'callback' => '',// 授权回调
            ],
        ],

        //  小程序配置
        'mini'=>[
            //  基本配置
            'app_id'  => '',
            'secret'  => '',
            'token' => '',
            'safeMode'=>0,
            'encodingAESKey'=>'',
            //  微信支付
            'payment' => [
                'mch_id'        => '',
                'key'           => '',
            ],
        ]
    ]
];
```

对于配置，请不要修改数据的key值。

使用（use）
-------

[](#使用use)

yii2-wx采用单一接口驱动功能的思路，比如下面的代码将生成一个微信带参数的二维码。

```
use abei2017\wx\Application;

//  方法一
$qrcode = (new Application())->driver('mp.qrcode');

//  方法二
$conf = Yii::$app->params['wechat'];// 自定义配置数组key（最后一层数组key不可以更改）
$app = new Application(['conf'=>$conf]);

$qrcode = $app->driver('mp.qrcode');
$data = $qrcode->intTemp(3600,9527);// 生成一个数字类临时二维码，有效期为3600秒
```

功能实现
----

[](#功能实现)

**微信公众号**

- 获取接口调用凭证
- 获取微信服务器IP地址
- 验证消息真实性
- 服务器接收实现
- 客户端响应相关接口
- 带参数的二维码
- 用户管理
- 素材管理
- 菜单管理
- 消息模板发送
- web授权机制
- JSSDK
- 微信支付（扫码支付/公众号浏览器支付）
- 企业付款到零钱包
- 现金红包

**微信小程序**

- 获取接口调用凭证
- 小程序码
- 小程序的微信支付
- 小程序模板
- 小程序客服消息
- 内容安全

开源协议（License）
-------------

[](#开源协议license)

MIT

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 98.8% 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 ~92 days

Recently: every ~168 days

Total

12

Last Release

1988d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8324b355b4af64677862e1e6bde0a8c4ad9b55963a1da0a592fd04249e726312?d=identicon)[abei2017](/maintainers/abei2017)

---

Top Contributors

[![abei2017](https://avatars.githubusercontent.com/u/25122181?v=4)](https://github.com/abei2017 "abei2017 (84 commits)")[![bosephadmin](https://avatars.githubusercontent.com/u/34975211?v=4)](https://github.com/bosephadmin "bosephadmin (1 commits)")

---

Tags

wechatwechat-paywechat-sdkyii2yii2-extensionyii2extensionwechat

### Embed Badge

![Health badge](/badges/abei2017-yii2-wx/health.svg)

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

###  Alternatives

[dmstr/yii2-cookie-consent

Yii2 Cookie Consent Widget

1452.6k](/packages/dmstr-yii2-cookie-consent)[imanilchaudhari/yii2-currency-converter

This extension will help to find out current currency conversion rate.

2011.6k](/packages/imanilchaudhari-yii2-currency-converter)[richardfan1126/yii2-js-register

Yii2 widget to register JS into view

1357.2k7](/packages/richardfan1126-yii2-js-register)[degordian/yii2-webhooks

Yii2 extension for webhooks

117.1k](/packages/degordian-yii2-webhooks)

PHPackages © 2026

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