PHPackages                             jtcczu/yii2-applet - 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. [Framework](/categories/framework)
4. /
5. jtcczu/yii2-applet

ActiveLibrary[Framework](/categories/framework)

jtcczu/yii2-applet
==================

Yii2 component for applet

1.1.1(8y ago)101.3k2MITPHPPHP &gt;=5.5

Since Jul 22Pushed 8y ago2 watchersCompare

[ Source](https://github.com/jtcczu/yii2-applet)[ Packagist](https://packagist.org/packages/jtcczu/yii2-applet)[ RSS](/packages/jtcczu-yii2-applet/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (4)Used By (0)

Yii2 Applet Extension
=====================

[](#yii2-applet-extension)

Yii2小程序组件 获取用户信息和会话密钥

环境需求
----

[](#环境需求)

- PHP &gt;= 5.5

安装
--

[](#安装)

```
composer require jtcczu/yii2-applet

```

配置
--

[](#配置)

```
return [
    //...
    'components' => [
        'applet' => [
          'class' => 'Jtcczu\Applet\Applet',
          'appid' => 'APPID',
          'secret' => 'SECRET'
        ]
    ]
]

```

使用
--

[](#使用)

```
 $applet = Yii::$app->applet->makeSession($code);
 $applet->getUser($encryptedData, $iv); //返回用户信息
 $applet->checkSignature($rawData, $signature); //数据签名校验

 $session = $applet->getSession();
 $session->getOpenid(); //openid
 $session->getSessionKey(); //session_key
 $session->getUnionid(); //unionid

```

微信小程序api文档

快速开始
----

[](#快速开始)

小程序代码

```
wx.login({
        success: function (login) {
          wx.getUserInfo({
            success: function (res) {
              wx.request({
                url: 'xxx',
                method : 'post',
                data:{
                    code : login.code,
                    rawData : res.rawData,
                    signature : res.signature,
                    encryptedData : res.encryptedData,
                    iv : res.iv
                },
                dataType : 'json',
                success : function(res){
                }
              })
            }
          })
        }
      })

```

后端代码

```
public function actionTest(){
  $contents = file_get_contents('php://input');
  $data = json_decode($contents,true);
  $user = Yii::$app->applet
                   ->makeSession($data['code'])
                   ->getUser($data['encryptedData'],$data['iv']);
}

```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

Established project with proven stability

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

Total

3

Last Release

3164d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0a198d7a0bd2421a2ff2e7b1dc1ae35531721cc253eefc02919dd66f1b00de6c?d=identicon)[jtcczu](/maintainers/jtcczu)

---

Top Contributors

[![jtcczu](https://avatars.githubusercontent.com/u/10527709?v=4)](https://github.com/jtcczu "jtcczu (29 commits)")

### Embed Badge

![Health badge](/badges/jtcczu-yii2-applet/health.svg)

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

###  Alternatives

[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k96.9M674](/packages/laravel-socialite)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19462.3M1.3k](/packages/drupal-core)[yii2-starter-kit/yii2-starter-kit

Yii2 Starter Kit Application Template

1.4k6.6k](/packages/yii2-starter-kit-yii2-starter-kit)[skeeks/cms

SkeekS CMS — control panel and tools based on php framework Yii2

13825.6k47](/packages/skeeks-cms)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

7310.3k29](/packages/open-dxp-opendxp)

PHPackages © 2026

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