PHPackages                             leegoway/mina - 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. leegoway/mina

ActiveLibrary

leegoway/mina
=============

小程序登录 php composer

332PHP

Since Jul 18Pushed 8y ago2 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

mina
====

[](#mina)

PHP mina login 小程序登录 PHP composer 包

\##使用方法
-------

[](#使用方法)

### 基础使用

[](#基础使用)

```
使用SessionService类调用微信小程序接口，获取sessionKey和openId

```

```
use leegoway\mina\SessionService;

$code = 'your code';//小程序本次回话code
$config = ['appid' => 'your appid', 'appsecret' => 'your appsecret'];//小程序配置
$sessionService = new SessionService($config);

$sessionInfo = $sessionService->getSessionId($code);
//return ['sessionId' => '', 'sessionKey' => '', 'openId' => ''];
```

### 作为Yii2的component使用

[](#作为yii2的component使用)

```
return [
    'components' => [
        'minaAuth' => [
            'class' => 'leegoway\mina\MinaFacade',
            'appid' => 'your appid',
            'appsecret' => 'your appsecret',
            'storeconfig' => [
            	'driver' => 'redis',   //存储类型
            	'component' => 'redis', //yii2的component
            	'expireSeconds' => 900, //session有效时间
            ],
        ]
    ],
];
```

```
$code = 'your code';//小程序本次回话code
$sessionInfo = Yii::$app->minaAuth->getSessionInfo($code);
//return ['sessionId' => '', 'sessionKey' => '', 'openId' => ''];
$openId = Yii::$app->minaAuth->getOpenId($sessionInfo['sessionId']);
//return openid
$sessionKey = Yii::$app->minaAuth->getSessionKey($sessionInfo['sessionId']);
//return sessionKey
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/48a1b11cecfc6371c2ca6fa10be4b7f87172c46a004c1ba5ef74e4f5e6c551ad?d=identicon)[leegoway](/maintainers/leegoway)

---

Top Contributors

[![leegoway](https://avatars.githubusercontent.com/u/16970488?v=4)](https://github.com/leegoway "leegoway (8 commits)")

---

Tags

loginminaminiappopenidsessionwechatwechat-appwechat-mini-program

### Embed Badge

![Health badge](/badges/leegoway-mina/health.svg)

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

PHPackages © 2026

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