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

ActiveLibrary

sunnnnn/wechat
==============

wechat for frame Yii2 and Thinkphp5

v1.1.0(9y ago)125MITPHPPHP &gt;=5.4.0

Since Dec 28Pushed 8y ago1 watchersCompare

[ Source](https://github.com/sunnnnn/wechat)[ Packagist](https://packagist.org/packages/sunnnnn/wechat)[ RSS](/packages/sunnnnn-wechat/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

微信借口开发，集成主流框架（thinkphp5、yii2）
=============================

[](#微信借口开发集成主流框架thinkphp5yii2)

\#配置 tp5 中config.php中放入配置信息： 'wechat' =&gt; \[ 'app\_id' =&gt; '', //app id 'app\_secret' =&gt; '', //app secret 'mch\_id' =&gt; '', //商户号 'mch\_key' =&gt; '', //商户 key 'cert\_path' =&gt; '', //证书路径 \], 'wxpay' =&gt; \[ 'app\_id' =&gt; '', //app id 'app\_secret' =&gt; '', //app secret 'mch\_id' =&gt; '', //商户号 'mch\_key' =&gt; '', //商户 key 'cert\_path' =&gt; '', //证书路径 'key\_path' =&gt; '', //证书路径 \],

controller： $wechat = new WechatTp();

\#扫码支付 $wxPay = new WxPayTp(); $src = $wxPay-&gt;native(\[ body=&gt;商品描述, attach=&gt;附加数据, outTradeOn=&gt;商户订单号, fee=&gt;费用, tag=&gt;商品标记, notify=&gt;回掉地址, productId=&gt;商品ID \]);

echo "[![]({$src})]({$src})";

\#js支付 $jsApiParameters = $wxPay-&gt;jsApi(\[ body=&gt;商品描述, attach=&gt;附加数据, outTradeOn=&gt;商户订单号, fee=&gt;费用, tag=&gt;商品标记, notify=&gt;回掉地址, productId=&gt;商品ID \]);

jsApiParameters为生成的用于调用微信支付接口的配置数据，用法查阅微信支付文档

```

yii2配置：
'components' => [
	'wechat' => [
		'class' => 'sunnnnn\wechat\mp\Wechat',
		'config' => [
			'app_id' => '',  //app id
			'app_secret' => '', //app secret
			'mch_id' => '', //商户号
			'mch_key' => '', //商户 key
			'cert_path' => '', //证书路径
		]
	],
	'wxpay' => [
		'class' => 'sunnnnn\wechat\pay\WxPay',
		'config' => [
			'app_id' => '',  //app id
			'app_secret' => '', //app secret
			'mch_id' => '', //商户号
			'mch_key' => '', //商户 key
			'cert_path' => '', //证书路径
			'key_path' => '', //证书路径
		]
	],
],

controller：

#扫码支付
$src = Yii::$app->wxpay->native([
	body=>商品描述,
	attach=>附加数据,
	outTradeOn=>商户订单号,
	fee=>费用,
	tag=>商品标记,
	notify=>回掉地址,
	productId=>商品ID
]);

echo "";

#js支付
$jsApiParameters = Yii::$app->wxpay->jsApi([
	body=>商品描述,
	attach=>附加数据,
	outTradeOn=>商户订单号,
	fee=>费用,
	tag=>商品标记,
	notify=>回掉地址,
	productId=>商品ID
]);

jsApiParameters为生成的用于调用微信支付接口的配置数据，用法查阅微信支付文档

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

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

Total

2

Last Release

3289d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5f28479f7ce1134f9e9f5dabb1742c1b6c19c9794d336f132ac7c3b46c98b6e4?d=identicon)[sunnnnn](/maintainers/sunnnnn)

---

Top Contributors

[![yaobuer](https://avatars.githubusercontent.com/u/12892462?v=4)](https://github.com/yaobuer "yaobuer (19 commits)")

### Embed Badge

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

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

PHPackages © 2026

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