PHPackages                             tebie6/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. [API Development](/categories/api)
4. /
5. tebie6/yii2-wx

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

tebie6/yii2-wx
==============

一个专注于yii2的微信sdk 出自abei2017 在基础上添加 APP支付

v1.3(8y ago)1402MITPHPPHP &gt;=5.4

Since Apr 12Pushed 4y agoCompare

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

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

> 为了更好的维护这个项目，避免多点分心。答疑和bug提交请在我的知识分享( [点击进入](http://nai8.me/forum/index.html?tag=108) )讨论页面提交，选择标签yii2-wx。

 [ ![yii2-wx Logo](https://camo.githubusercontent.com/e6c6d3001d2117d17d9d294ca3fd3e80361f16ece1991ade9f4e363343cd56ce/68747470733a2f2f6e6169382e6d652f696d616765732f796969322d77782d6c6f676f2e706e67) ](https://nai8.me/yii2wx)

 一款服务于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](https://camo.githubusercontent.com/f0916a2136b65a373dd61e4f398adb702dff5dba9676a736365f6e87d9c470b4/68747470733a2f2f6e6169382e6d652f696d616765732f6c6f676f2e706e67) ](https://nai8.me)

 [![北哥小报](https://camo.githubusercontent.com/828f30dc711faec027f642e249f6f681d7806b5c6097eb8109c118240e91a83a/68747470733a2f2f6e6169382e6d652f696d616765732f7172636f6465732f7869616f62616f2d7172636f64652e6a7067)](https://camo.githubusercontent.com/828f30dc711faec027f642e249f6f681d7806b5c6097eb8109c118240e91a83a/68747470733a2f2f6e6169382e6d652f696d616765732f7172636f6465732f7869616f62616f2d7172636f64652e6a7067)

 除了代码，还有诗和远方。扫码关注我的公众号。

文档
--

[](#文档)

- [中文文档](http://nai8.me/wiki/index.html?id=1)

系统需求（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'  => '',
            //  微信支付
            'payment' => [
                'mch_id'        => '',
                'key'           => '',
            ],
        ]
    ]
];
```

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

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

[](#使用use)

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

```
use abei2017\wx\Application;

$conf = Yii::$app->params['wx']['mp'];
$app = new Application(['conf'=>$conf]);

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

功能实现
----

[](#功能实现)

**微信公众号**

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

**微信小程序**

- 小程序码
- 小程序的微信支付
- 小程序模板

学习yii2-wx（learning yii2-wx）
---------------------------

[](#学习yii2-wxlearning-yii2-wx)

北哥已将yii2-wx的配置和使用设计的简单易懂，因此通过文档和速查表你可以轻松的学会它，但是这也需要你之前对微信相关文档有所阅读。

如果你是一名yii2或微信接口开发的初学者，我在自己的知识分享设置了一套针对性的视频课程（[点击查看](http://nai8.me/book/view.html?id=24)），我想能让你零起步。

支持（Support）
-----------

[](#支持support)

- [文档](http://nai8.me/wiki/index.html?id=1)
- [社区交流](https://nai8.me/forum/index.html?tags=108)
- [微信交流群](https://nai8.me/site/qun.html)

更多请参考

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

[](#开源协议license)

MIT

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 75% 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

4

Last Release

2953d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/472e668f00e0e78dae2645469ebcd6c933d5d71ad310b367a19cb0b329034f8c?d=identicon)[tebie6](/maintainers/tebie6)

---

Top Contributors

[![tebie6](https://avatars.githubusercontent.com/u/23230491?v=4)](https://github.com/tebie6 "tebie6 (3 commits)")[![YoungZiyi](https://avatars.githubusercontent.com/u/8380580?v=4)](https://github.com/YoungZiyi "YoungZiyi (1 commits)")

---

Tags

yii2extensionwechat

### Embed Badge

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

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

###  Alternatives

[dotzero/yii2-amocrm

Расширение для Yii Framework 2 реализующее клиент для работы с API amoCRM

1639.7k](/packages/dotzero-yii2-amocrm)[conquer/services

Yii2 soap wsdl web services

1632.5k](/packages/conquer-services)[apexwire/yii2-restclient

Tools to use API as ActiveRecord for Yii2

143.5k](/packages/apexwire-yii2-restclient)

PHPackages © 2026

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