PHPackages                             tsingsun/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. tsingsun/yii2-easy-wechat

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

tsingsun/yii2-easy-wechat
=========================

Easywechat sdk for yii2 php framework

0.1(8y ago)4164BSD-3-ClausePHP

Since Jul 11Pushed 8y ago1 watchersCompare

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

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

Yii2 EasyWechat
===============

[](#yii2-easywechat)

wechat extension for Yii2. this is base on [EasyWechat](https://easywechat.org)

[![Latest Stable Version](https://camo.githubusercontent.com/88ed50420a03f1de3e259604e857bc59280ac31b6f2794e03f8a535bf6876ecc/68747470733a2f2f706f7365722e707567782e6f72672f7473696e6773756e2f796969322d656173792d7765636861742f762f737461626c652e737667)](https://packagist.org/packages/tsingsun/yii2-easy-wechat)[![Build Status](https://camo.githubusercontent.com/420d863a8e4804c17ae5c5c5d98f4b08d36e2869686ac474a4f2bf3c35928322/68747470733a2f2f7472617669732d63692e6f72672f7473696e6773756e2f796969322d656173792d7765636861742e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/tsingsun/yii2-easy-wechat)[![Total Downloads](https://camo.githubusercontent.com/79864bcf1692bfd9fd53a2c14a8d27e3f9eb1b58b7277f31b0a6e0a3f3b0450b/68747470733a2f2f706f7365722e707567782e6f72672f7473696e6773756e2f796969322d656173792d7765636861742f646f776e6c6f6164732e737667)](https://packagist.org/packages/tsingsun/yii2-easy-wechat)

Installation
------------

[](#installation)

```
    composer require --prefer-dist tsingsun/yii2-easy-wechat

```

Configuration
-------------

[](#configuration)

```
'components' => [
        'cache' => [
            'class'=>'yii\caching\FileCache',
            'keyPrefix' => 'yak',
        ],
        'wechat'=>[
            'class'=>'yii\easyWechat\Wechat',
            //the config is all most match the easyWechat office's config,
            //the diffenrece please see Notice
            'config'=>[
                'debug'  => true,
                'app_id'=>'',
                'secret'=>'',
                'token'=>'',
                'aes_key'=>'',
                'payment'=>[
                    'merchant_id'=>'',
                    'key'=>'',
                    'cert_path'=>'',
                    'key_path'=>'',
                    'notify_url'=>''

                ],
                'oauth' => [
                    'scopes'   => ['snsapi_userinfo'],
                    'callback' => '/examples/oauth_callback.php',
                ],
                'guzzle' => [
                    'timeout' => 3.0, //
                    //'verify' => false, // close SSL verify（not suggust！！！）
                ],
                /**
                 * Cache,if not set ,use Yii default config cache
                 */
                'cache'=>[

                ],
            ],
        ],
        'log'=>[
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'maxFileSize'=> 200,
                    'levels' => [],
                    'logVars' => [],
                    'logFile' => '@runtime/logs/'.date('ymd').'.log',
                ],
            ]
        ],
    ]
```

#### Notice

[](#notice)

There are some change to better match for yii

- use Yii Logger component instead of EasyWechat default logger;
- use Yii Cache component instead of EasyWechat default Cache that based on \\Doctrine\\Common\\Cache\\Cache.

### how to use

[](#how-to-use)

```
    //after configure,use it as bellow
    /**
    * @var Wechat $wechat use @var doc attribute to code lint
    **/
    $wechat = Yii::$app->get('wechat');
    //$wechat->app is Easywechat's Application instance
    $wechat->app->server->setMessageHandler(function ($message) {
                return "hello world！welcome!";
            });
    $wechat->app->server()->send();
```

### how to Test

[](#how-to-test)

In the unit test process, also discovered the WeChat development debugging egg pain, because also combed the test better practice The tests are centered in the test directory. Go to the directory [测试说明](./tests/README.md)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

Unknown

Total

1

Last Release

3230d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/78bae55afca79d056d16701fc34948da0641203a3bb1bbb3b74501ddca8f6e01?d=identicon)[tsingsun](/maintainers/tsingsun)

---

Top Contributors

[![tsingsun](https://avatars.githubusercontent.com/u/5848549?v=4)](https://github.com/tsingsun "tsingsun (3 commits)")

---

Tags

easywechatwechatyii2

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[dmstr/yii2-cookie-consent

Yii2 Cookie Consent Widget

1452.6k](/packages/dmstr-yii2-cookie-consent)

PHPackages © 2026

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