Skip to content

phoenixgao/socialite

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Socialite

Socialite is a collection of OAuth 2 packages that extracts from laravel/socialite.

Install

$ composer require overtrue/socialite

Usage

authorize.php:

<?php

use Overtrue\Socialite\SocialiteManager;

include __DIR__.'/vendor/autoload.php';

$config = [
    'weibo' => [
        'client_id'     => 'your-app-id',
        'client_secret' => 'your-app-secret',
        'redirect'      => 'http://localhost/socialite/callback.php',
    ],
];

$socialite = new SocialiteManager($config);

$socialite->driver('weibo')->redirect()->response();

callback.php:

<?php

// ...
$user = $socialite->driver('weibo')->user();

var_dump($user);
// 'id' => int 2193182644
// 'nickname' => null
// 'name' => string '安正超' (length=9)
// 'email' => null
// 'avatar' => string 'http://tp1.sinaimg.cn/2193182644/180/40068307042/1' (length=50)

License

MIT

About

Socialite is a collection of OAuth 2 packages that extracts from laravel/socialite.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%