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

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

myshero/yii2-easy-wechat
========================

Easywechat sdk for yii2 php framework

0.1.1(8y ago)08MITPHPPHP &gt;=7.0

Since May 4Pushed 8y agoCompare

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

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

yii2-easy-wechat
================

[](#yii2-easy-wechat)

借鉴了一些其他 `EasyWeChat SDK for Yii2`，但好像都是针对 `EasyWeChat V3` 版本的。

本渣瞎捣鼓了一个针对 `EasyWeChat V4` 的，欢迎各路大佬指点。

Thank you.

### Installation

[](#installation)

`composer require myshero/yii2-easy-wechat --dev`

### Configuration

[](#configuration)

YII2 配置添加 `wechat` 组件

[更多参数说明](https://www.easywechat.com/docs/master/zh-CN/official-account/configuration)

```
'components' => [
    // ...
    'wechat'=>[
        'class'=>'Myshero\Wechat\Wechat',
        // 微信参数
        'config' => [
            'app_id' => 'app_id',
            'secret' => 'secret',
            'log' => [
                'level' => 'debug',
                'permission' => 0777,
                'file' => Yii::getAlias("@frontend") . '/runtime/wechat.log',
            ],
            /**
             * OAuth 配置
             *
             * scopes：公众平台（snsapi_userinfo / snsapi_base），开放平台：snsapi_login
             * callback：OAuth授权完成后的回调页地址
             */
            'oauth' => [
                'scopes' => ['snsapi_userinfo'],
                'callback' => 'wechat/oauth',
            ],
        ],
    ],
    // ...
],

```

### Usage

[](#usage)

```
// here are some representative examples that will help you:

// 微信网页授权:
public function actionIndex()
{
    $wechat = \Yii::$app->wechat;
    if ($wechat->isGuest()) {
        // 跳转微信服务器授权
        return $wechat->prepareOauth();
    }else{
        // do something ...
    }
}

/**
 * 授权回调
 */
public function actionOauth()
{
    $wechat = \Yii::$app->wechat;
    return $wechat->oauth();
}

------

\Yii::$app->wechat->officialAccount;  // 公众号
\Yii::$app->wechat->miniProgram;      // 小程序
\Yii::$app->wechat->openPlatform;     // 开放平台
\Yii::$app->wechat->payment;          // 微信支付
\Yii::$app->wechat->work;             // 企业微信

```

### More documentation

[](#more-documentation)

see [EasyWeChat Docs.](https://www.easywechat.com/)

Thanks to `overtrue/wechat`

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

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

2

Last Release

2928d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0743cc2e0736f24909b9ba999efaae9c3b9cd42000ecd6502c6735b5dddcdd78?d=identicon)[myshero](/maintainers/myshero)

---

Top Contributors

[![qiaolili](https://avatars.githubusercontent.com/u/24666928?v=4)](https://github.com/qiaolili "qiaolili (7 commits)")

### Embed Badge

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

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

###  Alternatives

[jianyan74/yii2-easy-wechat

WeChat SDK for yii2, 基于 overtrue/easywechat

14339.4k1](/packages/jianyan74-yii2-easy-wechat)[maxwen/yii2-easy-wechat

WeChat SDK for yii2, based on overtrue/easywechat

1858.8k1](/packages/maxwen-yii2-easy-wechat)[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)
