PHPackages                             jsanf/oauth - 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. jsanf/oauth

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

jsanf/oauth
===========

v1.1(5y ago)05MITPHPPHP ^7.3

Since Oct 13Pushed 5y ago1 watchersCompare

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

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

配置
==

[](#配置)

install
-------

[](#install)

```
composer require jsanf/oauth

```

config.php
----------

[](#configphp)

```
return [
    'Wechat' => [
        'appid' => 'wxedfaa675aa',        //个人微信appid
        'secret'=> '0a4ab6706702585c043c3d70245',
        'redirect_uri' => 'https://member-sso.pxo.cn/user/receive'  //回调地址
    ],
    'Wxwork' => [
        'agentid' => '1000170',
        'redirect_uri' => 'https://member-sso.pxo.cn/user/receive',     //回调地址

        //第三方应用
        'appid' => 'wwe394e1149a61',                                //suiteId
        'secret' => 'lQUGcC-5yScSKPGnheKuwB7CMCUOPk4ZM',      //suite_secret
        'token' => 'XPOLhzU227GemS',
        'EncodingAESKey' => '1QBd6iL5qKsjY0HsBA4vPtwBm8NSRz',

        //suite_ticket 缓存名称
        'suiteTicketCacheKey' => 'member:suite_ticket'
    ]
]

```

simple
------

[](#simple)

```
    /**
     * 第三方登录
     */
    public function third()
    {
        $oauth = (new Oauth)->getInstance("Wechat", $config['Wechat'] ?? '');
        if(!$oauth) {
            echo "该登录方式不存在.";
            exit;
        }
        $param['return_url'] = $this->get['return_url'];
        $param['oauth_type'] = 'Wechat';
        //$param['scope'] = $this->get['scope'] ?? 'snsapi_base';
        $oauth->code($param);
    }

    /**
     * 第三方回调
     * @throws \GuzzleHttp\Exception\GuzzleException
     */
    public function receive()
    {
        $config = $config['Wechat'] ?? [];
        if(!$config) {
            echo 'oauth_type有误.';exit;
        }

        $config['return_data'] = $this->get;
        $oauth = (new Oauth)->getInstance('Wechat', $config);
        $userInfo = $oauth->userInfo();

        $token = $userInfo['openid'];

        //保存用户信息

        //缓存用户信息到redis缓存
        $this->redis::set('member:'.$token, $userInfo);

        header("Location:" . $_GET['return_url'] . '?token=' . $token);
    }

```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

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

Every ~5 days

Total

2

Last Release

2038d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1247a172d6ef054d408f2e7c8b46cd8ed71b520a252c0b1b6eed04d53a4865b6?d=identicon)[zhangzhongxian](/maintainers/zhangzhongxian)

---

Top Contributors

[![jsanf](https://avatars.githubusercontent.com/u/16348035?v=4)](https://github.com/jsanf "jsanf (2 commits)")

### Embed Badge

![Health badge](/badges/jsanf-oauth/health.svg)

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

###  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)
