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

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

hug-code/oauth
==============

第三方授权登陆 QQ登陆 新浪微博登陆 github登陆

1.0.0(5y ago)07MITPHPPHP &gt;=7.0

Since Nov 11Pushed 5y ago1 watchersCompare

[ Source](https://github.com/hug-code/oauth)[ Packagist](https://packagist.org/packages/hug-code/oauth)[ Docs](http://www.hug-code.cn/)[ RSS](/packages/hug-code-oauth/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (2)Used By (0)

QQ、新浪微博、Github网页授权登陆
====================

[](#qq新浪微博github网页授权登陆)

### 安装

[](#安装)

```
composer require HugCode/Oauth
```

### Github 授权登陆

[](#github-授权登陆)

github API地址：

登陆流程：

```
// 定义配置文件
$config = [
    'client_id'=>'xxxxxxxxxxx',
    'client_secret'=>'xxxxxxxxxxxxxxxxxxxxxxx'
];

// 引入包
use HugCode\Third\Login\GithubLogin;
use HugCode\Third\Exception\MessageException;

// 调用登陆方法
try{
    $oauth = new GithubLogin($config);
    $user_info = $oauth->login();
}catch (MessageException $e){
    var_dump($e->getErrorMessage());
}
```

### 新浪微博 授权登陆

[](#新浪微博-授权登陆)

新浪微博开放平台:

登陆流程：

```
// 定义配置文件
$config = [
    'app_key' => 'xxxxxxxxxxx',
    'app_secret' => 'xxxxxxxxxxxxxxxxxxx',
    'redirect_uri' => '新浪后台配置的回调地址'
];

// 引入包
use HugCode\Third\Login\SinaLogin;
use HugCode\Third\Exception\MessageException;

//调用登陆方法
try{
    $oauth = new SinaLogin($config);
    $user_info = $oauth->login();
}catch (MessageException $e){
    var_dump($e->getErrorMessage());
}
```

### QQ 授权登陆

[](#qq-授权登陆)

QQ 互联地址：

登陆流程：

```
// 定义配置文件
$config = [
        'app_id' => 'xxxxxxxx',
        'app_key' => 'xxxxxxxxxxxxxxxxxxxxx',
        'redirect_uri' => 'QQ互联上配置的回调地址'
];

// 引入包
use HugCode\Third\Login\QqLogin;
use HugCode\Third\Exception\MessageException;

// 调用登陆方法
try{
    $oauth = new QqLogin($config);
    $user_info = $oauth->login();
}catch (MessageException $e){
    var_dump($e->getErrorMessage());
}
```

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

Maturity48

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

Unknown

Total

1

Last Release

2014d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2dc1d1915821cd9aa8eb6715a3d4c6785582b516548769eb2aa0f0a388378247?d=identicon)[huyashuai](/maintainers/huyashuai)

---

Top Contributors

[![huyashuai](https://avatars.githubusercontent.com/u/13412183?v=4)](https://github.com/huyashuai "huyashuai (3 commits)")

### Embed Badge

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

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

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

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