PHPackages                             agang235/thinksdk - 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. agang235/thinksdk

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

agang235/thinksdk
=================

第三方登录,qq登录,微信登录,微博登录

1.0.0(8y ago)6601[1 issues](https://github.com/agang235/thinksdk/issues)MITPHPPHP &gt;=5.3.0

Since Jan 17Pushed 8y ago1 watchersCompare

[ Source](https://github.com/agang235/thinksdk)[ Packagist](https://packagist.org/packages/agang235/thinksdk)[ RSS](/packages/agang235-thinksdk/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

项目简介：
=====

[](#项目简介)

> 1. 此项目并非原创,而是前端时间在github上查找第三方相关登录扩展时,没有找到合适的就在tp官网上找到一个比较全面和简洁的
> 2. 参考项目
> 3. 项目原地址

### 安装

[](#安装)

```
composer require agang235/thinksdk

```

1. 使用命名空间

```
use agang235\ThinkSDK\ThinkOauth;

```

2. 设置三方登录的类别并赋予一个变量

```
$type = ThinkOauth::getInstance('qq');

```

3. 设置配置文件

```
请查看 files/extra/sdk.php文件

```

4. 实例化一个登录页面

```
redirect($type->getRequestCodeURL());
        这里的$type是第二部获取的结果

```

5. 回调页面

```
请参照 files/extra/controller/Third.php文件

//授权回调地址
    public function callback($type = null, $code = null)
    {
        //支付宝code
        if ('alipay' == $type) {
            $code = $_GET['auth_code'];
        }
        (empty($type) || empty($code)) && $this->error('参数错误');

        //加载ThinkOauth类并实例化一个对象
        $sns = ThinkOauth::getInstance($type);

        //腾讯微博需传递的额外参数
        $extend = null;
        if ($type == 'tencent') {
            $extend = array('openid' => $this->_get('openid'), 'openkey' => $this->_get('openkey'));
        }

        //请妥善保管这里获取到的Token信息，方便以后API调用
        //调用方法，实例化SDK对象的时候直接作为构造函数的第二个参数传入
        //如： $qq = ThinkOauth::getInstance('qq', $token);
        $token = $sns->getAccessToken($code, $extend);

//         array(4) {//$token QQ登录返回数据样例
//         ["access_token"] => string(32) "A987D3A8400EA0FE5523797DD15D3277"
//         ["expires_in"] => string(7) "7776000"
//         ["refresh_token"] => string(32) "9F6E5D471FD744AFD4FA3A1EC117A583"
//         ["openid"] => string(32) "F8F13521AFC2443D03FD8CD01FB58C1F"
//          }
        //获取用户头像,昵称,性别等信息,
        //注意: 目前只支持qq和微信获取用户信息,其他的还没加,如果需要,用户可以自己在sdk中模仿微信和qq的方法来添加getUserInfo()方法
        $userInfo = $sns->getUserInfo($token);
        dump($userInfo);

    }

```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

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

3040d ago

### Community

Maintainers

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

---

Top Contributors

[![agang235](https://avatars.githubusercontent.com/u/25738075?v=4)](https://github.com/agang235 "agang235 (19 commits)")

---

Tags

php

### Embed Badge

![Health badge](/badges/agang235-thinksdk/health.svg)

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

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