PHPackages                             lyignore/wx-authorized-login - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. lyignore/wx-authorized-login

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

lyignore/wx-authorized-login
============================

Use the websocket authorization applet to get the phone number login

1.0.1(6y ago)03MITPHP

Since Apr 9Pushed 6y ago1 watchersCompare

[ Source](https://github.com/LYignore/wx-authorized-login)[ Packagist](https://packagist.org/packages/lyignore/wx-authorized-login)[ RSS](/packages/lyignore-wx-authorized-login/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

 wx-authorized-login
=====================

[](#-wx-authorized-login-)

 The PC side USES websocket authorization, the third party on the mobile side obtains user information, and the PC side logs in real time after authentication

Installing
----------

[](#installing)

Install import plug-in

> $ composer require lyignore/wx-authorized-login -vvv

laravel Introduce the service and the corresponding configuration information and front-end interface

> $ php artisan vendor:publish --provider="Lyignore\\WxAuthorizedLogin\\LoginServiceProvider"

A database table is introduced to record the login information

> $ php artisan migrate

Start websocket service

> $ php artisan websocket: start

Usage
-----

[](#usage)

```
// The front end connects to the websocket, and the successful connection returns a unique login identification ticket
// Assuming a successful websocket connection, the ticket obtained is '729ed9b40ad8'

$ticket = '729ed9b40ad8';

// Gets the data stream for the login qr code

$clientRepository = new Lyignore\WxAuthorizedLogin\Repositories\ClientRepository();
$ticketObj = $clientRepository->getTicket($ticket);
$result = $clientRepository->initUserLoginEntry($ticketObj, []);

// After the third party authorization, the calling background obtains the authenticated user information and then performs the PC side login

$ticket = $request->input('ticket');
$userRepository = new Lyignore\WxAuthorizedLogin\Repositories\UserRepository();
$ticketObj = $userRepository->getTicket($ticket);
$ticketObj->setIdentify($ticket);
$result = $userRepository->authorizedLogin($ticketObj, ['phone'=> '15641566789', 'user' => 'ly']);

// The PC front-end websocket gets the array passed by the second argument of authorizedLogin

```

Collcation
----------

[](#collcation)

```
// If using applet login, configure next time
// open file "/config/websocketlogin.php"
return [
    'helpfunction' => true, // 插件自定义的一些方法，命名和laravel方法冲突，引入laravel后设置成false即可
    'websocket' => [    // websocket配置的监听端口号和地址等信息
        'uri'  => '0.0.0.0',
        'port' => 8000,
        'worker_num'  => 8,
        'dispatch_mode' => 5,
        'package_max_length' => 8 * 1024 * 1024,
        'open_eof_check' => true,
        'original_name' => true,
        'daemonize' => false,
    ],
    'listern' => [
        'uri'  => '0.0.0.0',
        'port' => 8081,
        'worker_num' => 1,
        'dispatch_mode' => 1,
        'open_length_check' => true,
        'package_length_type' => 'N',
        'package_body_offset' => 4,
        'package_length_offset' => 0,
        'mode' => SWOOLE_PROCESS,
        'type' => SWOOLE_SOCK_TCP,
    ],
    'wxapplet' => [
        'wx_qr_logos' => 'https://api.weixin.qq.com/wxa/getwxacodeunlimit',
        'get_wx_openid' => 'https://api.weixin.qq.com/sns/jscode2session',
        'get_token_uri' => 'https://api.weixin.qq.com/cgi-bin/token',
        'appid' => 'wxde4673a351awe123',    // 小程序的APPID
        'secret'=> '2e9a9eec48f4824df22de90a422ase34',  // 小程序的SECRET
        'path'  => 'page/index/index',  // 小程序生成二维码，配置二维码的路由地址
    ],
    'memory' => [
        'fd' => 'int',
        'ticket' => 'string',
        'status' => 'int',
    ],
    'entry' => [
        'driver' => 'Lyignore\WxAuthorizedLogin\ResponseTypes\WechatQrResponse',    // 配置授权登录入口的驱动
    ]
];

```

Contributing
------------

[](#contributing)

You can contribute in one of three ways:

1. File bug reports using the [issue tracker](https://github.com/LYignore/wx-authorized-login/issues).
2. Answer questions or fix bugs on the [issue tracker](https://github.com/LYignore/wx-authorized-login/issues).
3. Contribute new features or update the wiki.

*The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.*

License
-------

[](#license)

MIT

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

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

Total

2

Last Release

2226d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1d14ab89a56f320a46083354c9bbb5cdc474a3eb97b92b2644fa9f2fe08d8b43?d=identicon)[lyignore](/maintainers/lyignore)

### Embed Badge

![Health badge](/badges/lyignore-wx-authorized-login/health.svg)

```
[![Health](https://phpackages.com/badges/lyignore-wx-authorized-login/health.svg)](https://phpackages.com/packages/lyignore-wx-authorized-login)
```

###  Alternatives

[josiasmontag/laravel-recaptchav3

Recaptcha V3 for Laravel package

2641.6M2](/packages/josiasmontag-laravel-recaptchav3)[rahul900day/laravel-captcha

Different types of Captcha implementation for Laravel Application.

10715.9k](/packages/rahul900day-laravel-captcha)[simplesamlphp/simplesamlphp-module-oidc

A SimpleSAMLphp module adding support for the OpenID Connect protocol

5016.9k1](/packages/simplesamlphp-simplesamlphp-module-oidc)[kinde-oss/kinde-auth-php

Kinde PHP SDK for authentication

2369.5k3](/packages/kinde-oss-kinde-auth-php)[descope/descope-php

Descope SDK for PHP

3814.0k](/packages/descope-descope-php)[njoguamos/laravel-turnstile

A laravel wrapper for https://developers.cloudflare.com/turnstile/

2315.9k2](/packages/njoguamos-laravel-turnstile)

PHPackages © 2026

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