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

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

lengnuan/yii2-wechat
====================

微信扩展

03PHP

Since Sep 11Pushed 5y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

lengnuan/yii2-wechat
====================

[](#lengnuanyii2-wechat)

微信扩展

安装
--

[](#安装)

安装此扩展的首选方法是通过 [composer](http://getcomposer.org/download/).

运行

```
composer require --prefer-dist lengnuan/yii2-wechat "dev-master"

```

或添加

```
"lengnuan/yii2-wechat": "*"

```

到 composer.json 文件的 require 部分

---

安装扩展程序后，main.php 文件中 components 中添加：

```
'wechat' => [
    'class' => 'lengnuan\wechat\WeChat',
],
```

params.php 添加：

```
// 微信基本配置
'weChat' => [
    'config' => [
        'appid'     => '',  // 开发者ID
        'secret'    => '',  // 开发者密码
        'token'     => '',  // Token
        'aeskey'    => '',  // 消息加解密密钥
    ]
],
```

用法
------------------------------------------

[](#用法-httpsdevelopersweixinqqcomdoc)

```
// 获取 access token
Yii::$app->wechat->accessToken;

// 获取微信callback IP地址
Yii::$app->wechat->callbackip;

// 创建临时整型 ticket
Yii::$app->wechat->getIntTicket(整型)->ticket;

// 创建临时字符串 ticket
Yii::$app->wechat->getStrTicket(字符串)->ticket;

// 创建永久整型 ticket
Yii::$app->wechat->getLimitIntTicket(整型)->ticket;

// 创建永久字符串 ticket
Yii::$app->wechat->getLimitStrTicket(字符串)->ticket;

// 获取二维码图片
Yii::$app->wechat->getIntTicket(整型)->qrcodeUrl;

// 关注者基本信息
Yii::$app->wechat->getUserInfo(openid);

// 模板消息
Yii::$app->wechat->sendTemplateMessage(数组);

// 客服消息
Yii::$app->wechat->sendCustomMessage(数组);

// 消息群发
Yii::$app->wechat->sendMassMessage(数组);

// 长链接转成短链接
Yii::$app->wechat->shortUrl(url);

// js api ticket
Yii::$app->wechat->jsapi->jsTicket;

// js api signature
Yii::$app->wechat->jsapi->jsapiSignature(url);

// s api code 获取 openid
Yii::$app->wechat->getJsapiCodeOpenId(code);
```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/4a8484139b8e37ba0c163f47c5437cc4a85f7e0d664f76516781708ce206e58c?d=identicon)[lengnuan-v](/maintainers/lengnuan-v)

---

Top Contributors

[![lengnuan-v](https://avatars.githubusercontent.com/u/45681358?v=4)](https://github.com/lengnuan-v "lengnuan-v (14 commits)")

### Embed Badge

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

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

###  Alternatives

[prestashop/ps_googleanalytics

PrestaShop module ps\_googleanalytics

426.3M2](/packages/prestashop-ps-googleanalytics)[nystudio107/craft-vite

Allows the use of the Vite.js next generation frontend tooling with Craft CMS

55301.5k31](/packages/nystudio107-craft-vite)[devtical/nova-qrcode-field

Nova QR code field

4560.6k2](/packages/devtical-nova-qrcode-field)[marcorieser/statamic-livewire

A Laravel Livewire integration for Statamic.

2381.5k10](/packages/marcorieser-statamic-livewire)[opendialogai/core

The OpenDialog Core package

3215.9k1](/packages/opendialogai-core)

PHPackages © 2026

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