PHPackages                             ranj/socialite - 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. ranj/socialite

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

ranj/socialite
==============

A collection of OAuth 2 packages.

1.0.1(2y ago)0161MITPHPPHP &gt;=8.0.2

Since Nov 16Pushed 2y ago1 watchersCompare

[ Source](https://github.com/wpyaa/socialite)[ Packagist](https://packagist.org/packages/ranj/socialite)[ RSS](/packages/ranj-socialite/feed)WikiDiscussions main Synced 1mo ago

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

Socialite
=========

[](#socialite)

Socialite 是一个 [OAuth2](https://oauth.net/2/) 认证工具。 它的灵感来源于 [laravel/socialite](https://github.com/laravel/socialite) ， 你可以很轻易的在任何 PHP 项目中使用它。[英文文档](/README_EN.md)

[![GitHub release (latest SemVer)](https://camo.githubusercontent.com/4ef429c1d4a56953848b4620e1f74a898e84a4c68896c4685750b9db5bc7df32/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6f766572747275652f736f6369616c6974653f7374796c653d666c61742d737175617265)](https://github.com/overtrue/socialite/releases)[![GitHub License](https://camo.githubusercontent.com/b2879135eea1937f1ccc697eb1182429fef7ec186759f0390854b5f68a2dce5e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6f766572747275652f736f6369616c6974653f7374796c653d666c61742d737175617265)](https://github.com/overtrue/socialite/blob/master/LICENSE)[![Packagist Downloads](https://camo.githubusercontent.com/244762ebd17c08d0f71bb989d472781384737a532a417fb8075625fe6a95903b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f766572747275652f736f6369616c6974653f7374796c653d666c61742d737175617265)](https://packagist.org/packages/overtrue/socialite)

[![Sponsor me](https://github.com/overtrue/overtrue/raw/master/sponsor-me-button-s.svg?raw=true)](https://github.com/sponsors/overtrue)

该工具现已支持平台有：Facebook，Github，Google，Linkedin，Outlook，QQ，TAPD，支付宝，淘宝，百度，钉钉，微博，微信，抖音，飞书，Lark，豆瓣，企业微信，腾讯云，Line，Gitee，Coding。

如果你喜欢我的项目并想支持我，[点击这里 ❤️](https://github.com/sponsors/overtrue)

版本要求
====

[](#版本要求)

```
PHP >= 8.0.2

```

安装
==

[](#安装)

```
$ composer require "overtrue/socialite" -vvv
```

使用指南
====

[](#使用指南)

用户只需要创建相应配置变量，然后通过工具为各个平台创建认证应用，并轻松获取该平台的 access\_token 和用户相关信息。工具实现逻辑详见参照各大平台 OAuth2 文档。

工具使用大致分为以下几步：

1. 配置平台设置
2. 创建对应平台应用
3. 让用户跳转至平台认证
4. 服务器收到平台回调 Code，使用 Code 换取平台处用户信息（包括 access\_token）

为 Laravel 用户创建的更方便的整合的包： [overtrue/laravel-socialite](https://github.com/overtrue/laravel-socialite)

`authorize.php`: 让用户跳转至平台认证

```
