Download the PHP package barretzhi/socialite without Composer
On this page you can find all versions of the php package barretzhi/socialite. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package socialite
Socialite
Socialite is an OAuth2 Authentication tool. It is inspired by laravel/socialite, You can easily use it in any PHP project.
Requirement
Installation
Usage
For Laravel 5: overtrue/laravel-socialite
authorize.php
:
callback.php
:
Configuration
Now we support the following sites:
facebook
, github
, google
, linkedin
, weibo
, qq
, wechat
, wechat_open
, and douban
.
Each drive uses the same configuration keys: client_id
, client_secret
, redirect
.
Example:
Special configuration options for WeChat Open Platform
Scope
Before redirecting the user, you may also set "scopes" on the request using the scope method. This method will overwrite all existing scopes:
Redirect URL
You may also want to dynamic set redirect
,you can use the following methods to change the redirect
URL:
WeChat scopes:
snsapi_base
,snsapi_userinfo
- Used to Media Platform Authentication.snsapi_login
- Used to web Authentication.
Additional parameters
To include any optional parameters in the request, call the with method with an associative array:
User interface
Standard user api:
You can fetch the user attribute as a array key like this:
Or using method:
Get original response from OAuth API
The $user->getOriginal()
method will return an array of the API raw response.
Get access token Object
You can get the access token instance of current session by call $user->getToken()
or $user->getAccessToken()
or $user['token']
.
Get user with access token
Custom Session or Request instance.
You can set the request with your custom Request
instance which instanceof Symfony\Component\HttpFoundation\Request
before you call driver
method.
Or set request to SocialiteManager
instance:
You can get the request from SocialiteManager
instance by getRequest()
:
Set custom session manager.
By default, the SocialiteManager
use Symfony\Component\HttpFoundation\Session\Session
instance as session manager, you can change it as following lines:
Your custom session manager must be implement the
Symfony\Component\HttpFoundation\Session\SessionInterface
.
Enjoy it! :heart:
Reference
- Google - OpenID Connect
- Facebook - Graph API
- Linkedin - Authenticating with OAuth 2.0
- 微博 - OAuth 2.0 授权机制说明
- QQ - OAuth 2.0 登录QQ
- 微信公众平台 - OAuth文档
- 微信开放平台 - 网站应用微信登录开发指南
- 微信开放平台 - 代公众号发起网页授权
- 豆瓣 - OAuth 2.0 授权机制说明
License
MIT
All versions of socialite with dependencies
guzzlehttp/guzzle Version ~5.0|~6.0
symfony/http-foundation Version ~2.6|~2.7|~2.8|~3.0