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

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

kail520/yii2-wx
===============

yii2-sdk

v1.0.6(6y ago)023MITPHPPHP &gt;=5.4

Since Jul 10Pushed 4y agoCompare

[ Source](https://github.com/kail520/yii2-wx)[ Packagist](https://packagist.org/packages/kail520/yii2-wx)[ RSS](/packages/kail520-yii2-wx/feed)WikiDiscussions master Synced yesterday

READMEChangelog (7)Dependencies (2)Versions (8)Used By (0)

 [ ![yii2-wx Logo](https://camo.githubusercontent.com/d8baf9ee46c0d08ab1c99cd109b95229df2ae75ed5f1ee9e89a438c6934645e6/687474703a2f2f7777772e796969322d77782e636f6d2f696d616765732f6c6f676f2e706e67) ](https://yii2-wx.com)

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

 [![](https://camo.githubusercontent.com/18fb33692ec5d92e315b0b7e02726875c6440d3163e746bd8552685c77db0698/68747470733a2f2f706f7365722e707567782e6f72672f6b61696c3532302f796969322d77782f762f737461626c65)](https://camo.githubusercontent.com/18fb33692ec5d92e315b0b7e02726875c6440d3163e746bd8552685c77db0698/68747470733a2f2f706f7365722e707567782e6f72672f6b61696c3532302f796969322d77782f762f737461626c65) [![](https://camo.githubusercontent.com/a14387e816cd82d8b39f85ea68fa639f8dd551988b5144d29eb54986f61bf208/68747470733a2f2f706f7365722e707567782e6f72672f6b61696c3532302f796969322d77782f646f776e6c6f616473)](https://camo.githubusercontent.com/a14387e816cd82d8b39f85ea68fa639f8dd551988b5144d29eb54986f61bf208/68747470733a2f2f706f7365722e707567782e6f72672f6b61696c3532302f796969322d77782f646f776e6c6f616473) [![](https://camo.githubusercontent.com/fe8bdd7d793a3261f419f6caa9e91b43096b1af1892e6ef218449110002b8f67/68747470733a2f2f706f7365722e707567782e6f72672f6b61696c3532302f796969322d77782f762f756e737461626c65)](https://camo.githubusercontent.com/fe8bdd7d793a3261f419f6caa9e91b43096b1af1892e6ef218449110002b8f67/68747470733a2f2f706f7365722e707567782e6f72672f6b61696c3532302f796969322d77782f762f756e737461626c65) [![](https://camo.githubusercontent.com/a6e45a4a10ba156cfb4ded721db6a3cd134affced2720d02a8d0767471c01012/68747470733a2f2f706f7365722e707567782e6f72672f6b61696c3532302f796969322d77782f6c6963656e7365)](https://camo.githubusercontent.com/a6e45a4a10ba156cfb4ded721db6a3cd134affced2720d02a8d0767471c01012/68747470733a2f2f706f7365722e707567782e6f72672f6b61696c3532302f796969322d77782f6c6963656e7365)

---

文档
--

[](#文档)

- [中文文档](http://www.yii2-wx.com/wiki)

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

[](#系统需求requirement)

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

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

[](#安装installation)

```
$ composer require "kail520/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 kail520\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

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity59

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

Total

7

Last Release

2479d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/21029751?v=4)[kail520](/maintainers/kail520)[@kail520](https://github.com/kail520)

---

Top Contributors

[![kail520](https://avatars.githubusercontent.com/u/21029751?v=4)](https://github.com/kail520 "kail520 (10 commits)")

---

Tags

yii2extensionwechat

### Embed Badge

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

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

###  Alternatives

[abei2017/yii2-wx

一个专注于yii2的微信sdk

1482.8k](/packages/abei2017-yii2-wx)[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)
