PHPackages                             ny/sso\_client\_sdk - 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. ny/sso\_client\_sdk

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

ny/sso\_client\_sdk
===================

sso client sdk

v2.1.0.3(4y ago)0185nonePHPPHP &gt;=7.2

Since Jul 12Pushed 3y ago1 watchersCompare

[ Source](https://github.com/hhniao/sso_client_sdk)[ Packagist](https://packagist.org/packages/ny/sso_client_sdk)[ RSS](/packages/ny-sso-client-sdk/feed)WikiDiscussions v2.1.0.0 Synced 1mo ago

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

sso\_client\_sdk
================

[](#sso_client_sdk)

#### 安装

[](#安装)

```
// 设置阿里云镜像
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
// 安装
composer require ny/sso_client_sdk -vvv
// 配置文件, 复制配置文件到你的项目配置文件目录
cp vendor/ny/sso_client_sdk/src/config/config.php

```

#### 使用示例

[](#使用示例)

```
// !!! 注意以下接口需要在sso 后台添加推送地址
// 1. 注册
$ssoToken = $_REQUEST['sso_token'];
$client   = Client::getInstance(config('sso'), Cache::store('redis'));
$ssoUser  = $client->user->me($ssoToken);
// ... 本地登录业务代码
// ... 根据 sso 用户信息查询本地用户信息
$localtoken = '';
$client->auth->setLogin($localtoken, $ssoToken);

// 2. 退出登录
$client     = Client::getInstance(config('sso'), Cache::store('redis'));
$localToken = $client->auth->getLocalToken($ssoToken);
$client->auth->setLogout($localToken);

// 3. 更新用户资料
try {

    $client = Client::getInstance(config('sso'), CacheClient::getClient());

    $data        = $_POST;
    $data['uri'] = '/' . request()->path();
    if (!$client->checkSign($data)) {
        die('error');
    }

    $tmp = [];
    if (isset($data['sex'])) {
        $tmp['gender'] = $data['sex'];
    }
    if (isset($data['head_img'])) {
        $tmp['avatar'] = $data['head_img'];
    }
    if (isset($data['nickname'])) {
        $tmp['nickname'] = $data['nickname'];
    }

    $userUnion = new UserUnion();
    $model = $userUnion->where('open_id', $data['openid'])->find();
    if ($model === null) {
        die('success'); // 找不到该用户, 返回成功, 不再推送.
    }
    /* @var \app\common\model\User $user */
    $user = $model->user;
    $user->save($tmp);
    die('success');
} catch (\Exception $e) {

}
die('error');

```

#### 版本日志

[](#版本日志)

1. v2.1.0.0

    a. 增加缓存

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

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

Recently: every ~133 days

Total

6

Last Release

1166d ago

Major Versions

v2.1.0.3 → v3.0.0.0-dev2023-03-01

### Community

Maintainers

![](https://www.gravatar.com/avatar/d8964033f1de47a40a948320815946aeeb53fa4eea47fe153cbc6ab3f7357be2?d=identicon)[liux15658](/maintainers/liux15658)

---

Top Contributors

[![hhniao](https://avatars.githubusercontent.com/u/12420958?v=4)](https://github.com/hhniao "hhniao (66 commits)")

---

Tags

SSOsso client sdk

### Embed Badge

![Health badge](/badges/ny-sso-client-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/ny-sso-client-sdk/health.svg)](https://phpackages.com/packages/ny-sso-client-sdk)
```

###  Alternatives

[league/oauth2-client

OAuth 2.0 Client Library

3.8k118.6M1.2k](/packages/league-oauth2-client)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[jasny/sso

Simple Single Sign-On

1.5k255.9k6](/packages/jasny-sso)[simplesamlphp/simplesamlphp-module-oidc

A SimpleSAMLphp module adding support for the OpenID Connect protocol

5016.9k1](/packages/simplesamlphp-simplesamlphp-module-oidc)[spinen/laravel-discourse-sso

Integrate Discourse SSO into Laravel.

4897.8k](/packages/spinen-laravel-discourse-sso)[maicol07/flarum-ext-sso

SSO for Flarum

468.3k](/packages/maicol07-flarum-ext-sso)

PHPackages © 2026

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