PHPackages                             xxh/think-wxminihelper - 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. xxh/think-wxminihelper

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

xxh/think-wxminihelper
======================

weixin mini program helper

1.0(9y ago)1551.2k79[3 issues](https://github.com/wulongtao/think-wxminihelper/issues)MITPHPPHP &gt;=5.3.0

Since Jan 18Pushed 8y ago17 watchersCompare

[ Source](https://github.com/wulongtao/think-wxminihelper)[ Packagist](https://packagist.org/packages/xxh/think-wxminihelper)[ RSS](/packages/xxh-think-wxminihelper/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

think-wxminihelper
==================

[](#think-wxminihelper)

基于ThinkPHP5.0的微信小程序composer包。

安装方法：

> composer require xxh/think-wxminihelper

你只需要两部就可以实现微信的登录验证，验证成功后会自动返回一个3rd\_session，和用户的基本信息

> 这里要注意的是，获取3rd\_session因为微信官网建议Linux下面读取/dev/urandom设备, 所以这段代码只适合用于linux系统，但是如果你需要在Windows系统上测试，那么可以修改 WXLoginHelper下的randomFromDev方法

1.在config.php配置文件中加入必须的配置

```
// wx配置
'wx'  => [
    'url' => 'https://api.weixin.qq.com/sns/jscode2session',
    'appid' => 'wxde3ea15f3a18f7f6',
    'secret' => '53b1a4e12b88d78f3bcc2786fb72adcf',
    'grant_type' => 'authorization_code'
]

```

2.使用`checkLogin`进行验证

```
$code = input("code", '', 'htmlspecialchars_decode');
$rawData = input("rawData", '', 'htmlspecialchars_decode');
$signature = input("signature", '', 'htmlspecialchars_decode');
$encryptedData = input("encryptedData", '', 'htmlspecialchars_decode');
$iv = input("iv", '', 'htmlspecialchars_decode');

$wxHelper = new WXLoginHelper();
$data = $wxHelper->checkLogin($code, $rawData, $signature, $encryptedData, $iv);

```

当然，如果你自己有一套登录验证流程，你也可以使用`decryptData`进行解密验证前面的正确性

```
$appid = 'wx4f4bc4dec97d474b';
$sessionKey = 'tiihtNczf5v6AKRyjwEUhQ==';

$encryptedData="CiyLU1Aw2KjvrjMdj8YKliAjtP4gsMZM
                QmRzooG2xrDcvSnxIMXFufNstNGTyaGS
                9uT5geRa0W4oTOb1WT7fJlAC+oNPdbB+
                3hVbJSRgv+4lGOETKUQz6OYStslQ142d
                NCuabNPGBzlooOmB231qMM85d2/fV6Ch
                evvXvQP8Hkue1poOFtnEtpyxVLW1zAo6
                /1Xx1COxFvrc2d7UL/lmHInNlxuacJXw
                u0fjpXfz/YqYzBIBzD6WUfTIF9GRHpOn
                /Hz7saL8xz+W//FRAUid1OksQaQx4CMs
                8LOddcQhULW4ucetDf96JcR3g0gfRK4P
                C7E/r7Z6xNrXd2UIeorGj5Ef7b1pJAYB
                6Y5anaHqZ9J6nKEBvB4DnNLIVWSgARns
                /8wR2SiRS7MNACwTyrGvt9ts8p12PKFd
                lqYTopNHR1Vf7XjfhQlVsAJdNiKdYmYV
                oKlaRv85IfVunYzO0IKXsyl7JCUjCpoG
                20f0a04COwfneQAGGwd5oa+T8yO5hzuy
                Db/XcxxmK01EpqOyuxINew==";

$iv = 'r7BXXKkLb8qrSNn05n0qiA==';

$pc = new \think\wxmini\WXBizDataCrypt($appid, $sessionKey);
$errCode = $pc->decryptData($encryptedData, $iv, $data );

if ($errCode == 0) {
    print($data . "\n");
} else {
    print($errCode . "\n");
}
```

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity58

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

3401d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/23cc3dea271e68e8e5beae46070ca8b676d499950928ed3d3f161607679ac4c3?d=identicon)[wulongtao](/maintainers/wulongtao)

---

Top Contributors

[![wulongtao](https://avatars.githubusercontent.com/u/15772596?v=4)](https://github.com/wulongtao "wulongtao (36 commits)")

---

Tags

phpthinkphp

### Embed Badge

![Health badge](/badges/xxh-think-wxminihelper/health.svg)

```
[![Health](https://phpackages.com/badges/xxh-think-wxminihelper/health.svg)](https://phpackages.com/packages/xxh-think-wxminihelper)
```

###  Alternatives

[ilya/belt

A handful of tools for PHP developers.

71020.8k1](/packages/ilya-belt)[nfourtythree/entriessubset

Craft field type plugin that extends the core Entries field type to give extra settings with ability to restrict by entry type

1683.0k](/packages/nfourtythree-entriessubset)[ryanpotter/silverstripe-color-field

Silverstripe Color Field

1059.3k11](/packages/ryanpotter-silverstripe-color-field)[lamalama/laravel-wishlist

Make your models wishlistable

238.1k](/packages/lamalama-laravel-wishlist)[kibatic/datagrid-bundle

Datagrid for Symfony

1418.3k](/packages/kibatic-datagrid-bundle)[prettybx/support

Pretty Bitrix

195.5k1](/packages/prettybx-support)

PHPackages © 2026

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