PHPackages                             urumuqi/wxxcx - 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. urumuqi/wxxcx

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

urumuqi/wxxcx
=============

A WeChat applet (wechat mini) plugins for Laravel 5.x

v1.1(6y ago)015MITPHPPHP &gt;=7.0

Since Jun 12Pushed 6y ago1 watchersCompare

[ Source](https://github.com/Urumuqi/wxxcx)[ Packagist](https://packagist.org/packages/urumuqi/wxxcx)[ RSS](/packages/urumuqi-wxxcx/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (3)Used By (0)

感谢 🙏iwanli
==========

[](#感谢-iwanli)

Laravel 5.x 微信小程序扩展
===================

[](#laravel-5x-微信小程序扩展)

小程序API接口
--------

[](#小程序api接口)

- 用户登录：[wx.login](https://mp.weixin.qq.com/debug/wxadoc/dev/api/api-login.html)
- 获取用户信息：[wx.getUserInfo](https://mp.weixin.qq.com/debug/wxadoc/dev/api/open.html#wxgetuserinfoobject)

安装
--

[](#安装)

执行以下命令安装最新稳定版本:

**PHP &gt; 7.1**

```
composer require urumuqi/wxxcx=1.1
```

或者添加如下信息到你的 `composer.json` 文件中 :

**PHP &gt; 7.1**

```
"urumuqi/wxxcx": "^1.0"
```

然后注册服务提供者到 Laravel中 具体位置：`/config/app.php` 中的 `providers` 数组:

```
Urumuqi\Wxxcx\WxxcxServiceProvider::class,
```

发布配置文件:

```
php artisan vendor:publish --tag=wxxcx
```

命令完成后，会添加一个`wxxcx.php`配置文件到您的配置文件夹 如 : `/config/wxxcx.php`。

生成配置文件后，将小程序的 `AppID` 和 `AppSecret` 填写到 `/config/wxxcx.php` 文件中

在Laravel 5控制器中使用 (示例)
---------------------

[](#在laravel-5控制器中使用-示例)

```
...

use Urumuqi\Wxxcx\Wxxcx;

class WxxcxController extends Controller
{
    protected $wxxcx;

    function __construct(Wxxcx $wxxcx)
    {
        $this->wxxcx = $wxxcx;
    }

    /**
     * wx.getUserInfo 解析加密数据.
     */
    public function getWxUserInfo()
    {
        // 微信登陆，获取到的session_key
        $sessionKey = request('session_key', '');
        //encryptedData 和 iv 在小程序端使用 wx.getUserInfo 获取
        $encryptedData = request('encrypted_data', '');
        $iv = request('iv', '');

        return $this->wxxcx->getUserInfo($encryptedData, $iv, $sessionKey);
    }
}
```

用户信息返回格式:

```
{
    "openId": "xxxx",
    "nickName": "nickname",
    "gender": 1,
    "language": "zh_CN",
    "city": "",
    "province": "Shanghai",
    "country": "CN",
    "avatarUrl": "http://wx.qlogo.cn/mmopen/xxxx",
    "watermark": {
        "timestamp": 1495867603,
        "appid": "your appid"
    }
}

```

小程序端获取 code、iv、encryptedData 向服务端发送请求示例代码：
------------------------------------------

[](#小程序端获取-codeivencrypteddata-向服务端发送请求示例代码)

```
//调用登录接口
wx.login({
    success: function (response) {
        var code = response.code
        wx.getUserInfo({
            success: function (resp) {
                wx.request({
                    url: 'your domain',
                    data: {
                        code: code,
                        iv: resp.iv,
                        encrypted_data: resp.encryptedData
                    },
                    success: function (res) {
                        console.log(res.data)
                    }
                })
            }
        })
    },
    fail:function(){
        ...
    }
})
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 77.8% 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 ~63 days

Total

2

Last Release

2463d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4e4262dfe3b44bbc5fb4faebacc5ca742e4f236ed98c5202a3b43f90bb244f1c?d=identicon)[urumuqi](/maintainers/urumuqi)

---

Top Contributors

[![Urumuqi](https://avatars.githubusercontent.com/u/4235526?v=4)](https://github.com/Urumuqi "Urumuqi (7 commits)")[![cyij](https://avatars.githubusercontent.com/u/2336421?v=4)](https://github.com/cyij "cyij (1 commits)")[![lanceWan](https://avatars.githubusercontent.com/u/7288380?v=4)](https://github.com/lanceWan "lanceWan (1 commits)")

### Embed Badge

![Health badge](/badges/urumuqi-wxxcx/health.svg)

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

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)

PHPackages © 2026

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