PHPackages                             hardywen/social-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. hardywen/social-login

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

hardywen/social-login
=====================

Use QQ or Sina Weibo login

v0.3.1(11y ago)111.9k5MITPHPPHP &gt;=5.4.0

Since Apr 17Pushed 11y ago4 watchersCompare

[ Source](https://github.com/hardywen/social-login)[ Packagist](https://packagist.org/packages/hardywen/social-login)[ RSS](/packages/hardywen-social-login/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (1)Versions (5)Used By (0)

Laravel 5.0 的可以看看这个扩展（没用过，不过貌似不错的样子）。

2015-05-27更新（对应 v0.3）： 添加 logout() 方法解决切换用户产生的bug。(bug:只返回第一次用户的信息)。 添加了 auto\_logout 配置项，默认为true, 会监听 auth.logout 事件，在触发该事件后清掉第三方登录session。 比如 Laravel的 Auth::logout() 方法就会触发这个事件。 当然你也可以手动调用 `SocialLogin::logout()`方法来清除。

2015-05-05更新（对应 v0.2）： 将Sina和QQ的getUserInfo方法统一返回为对象格式。如果你不想改你现在的代码，你可以使用 `  "hardywen/social-login": "v0.1"`版本。

social-login
============

[](#social-login)

Sina and QQ login

Install:

1.Add hardywen/social-login to composer.json

```
"require": {
  "hardywen/social-login": "v0.3"
}

```

2.Use composer to install this package.

```
$ composer update

```

3.Publish the config files.

```
$ php artisan config:publish hardywen/social-login

```

### Registering the Package

[](#registering-the-package)

Register the service provider within the `providers` array found in `app/config/app.php`:

```
'providers' => array(
	// ...

	'Hardywen\SocialLogin\SocialLoginServiceProvider'
)
```

Add an alias within the `aliases` array found in `app/config/app.php`:

```
'aliases' => array(
	// ...

	'SocialLogin' =>'Hardywen\SocialLogin\Facade\SocialLogin',
)
```

\###Config

```
return array(

 //当auto_logout设置为true时，调用Auth::logout()方法或者其他方式触发auth.logout事件后，Social-login会退出所有当前登录的第三方账号（包括Sina 和 QQ）。如果设置为false，你需要手动调用logout()方法。 例如：SocialLogin::logout();

    'auto_logout' => true, //建议为 true 值即可。

    //services APPID  APPKEY  and so on

    'services' => array(
        'QQ' => array(
            'APP_ID' => 'xxxx', //Your app id from you App
            'APP_KEY' => 'xxxx',
            'CALL_BACK' => '', //blank means it will call back to where you call login() function
            'SCOPE' => '',
        ),

        'Sina' => array(
            'APP_KEY' => 'xxx',//Your app id from you App
            'APP_SERCET' => '',
            'CALL_BACK' => '', //blank means it will call back to where you call login() function
        ),
    ),
);
```

\###Usage

login:

```
SocialLogin::consumer('QQ')->login(); // call this function to jump to QQ login page.
```

And after you login QQ, it will return to the callback url with "code" and "state" params

Then in your callbak page call this function :

```
SocialLogin::consumer('QQ')->callBack(); //This will get access_token and opend_id for you.
```

Now you can use

```
SocialLogin::consumer('QQ')->getUserInfo();
```

to get the login user info.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity51

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

Total

4

Last Release

4089d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/730b1d31144cf283dd5a4f979a32cff0fec848d33fd13bbe6488c5509417f6c7?d=identicon)[hardywen](/maintainers/hardywen)

---

Top Contributors

[![hardywen](https://avatars.githubusercontent.com/u/7113324?v=4)](https://github.com/hardywen "hardywen (18 commits)")

---

Tags

phplaravelSocial LoginQQ LoginSina Login

### Embed Badge

![Health badge](/badges/hardywen-social-login/health.svg)

```
[![Health](https://phpackages.com/badges/hardywen-social-login/health.svg)](https://phpackages.com/packages/hardywen-social-login)
```

###  Alternatives

[directorytree/ldaprecord-laravel

LDAP Authentication &amp; Management for Laravel.

5732.5M23](/packages/directorytree-ldaprecord-laravel)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[asbiin/laravel-webauthn

Laravel Webauthn support

311667.7k](/packages/asbiin-laravel-webauthn)[masterix21/laravel-licensing

Laravel licensing package with polymorphic assignment to any model, activation keys, expirations/renewals, and seat control via LicenseUsage. Supports offline verification with public-key–signed tokens, a CLI to generate/rotate/revoke keys, and an extensible architecture via config and contracts.

1614.1k4](/packages/masterix21-laravel-licensing)[api-platform/laravel

API Platform support for Laravel

58190.1k21](/packages/api-platform-laravel)

PHPackages © 2026

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