yunwuxin/think-social
最新稳定版本:v4.0.1
Composer 安装命令:
composer require yunwuxin/think-social
包简介
ThinkPHP6 Social SDK
README 文档
README
安装
composer require yunwuxin/think-social
配置
目前支持4个平台的:qq,weibo,github,wechat
配置示例
...
'weibo' => [
'client_id' => 'your-app-id',
'client_secret' => 'your-app-secret',
],
...
使用
路由
Route::get('auth/:channel/callback', 'Auth/handleSocialCallback');
Route::get('auth/:channel', 'Auth/redirectToSocial');
控制器
<?php namespace app\controller; use yunwuxin\Social; class AuthController extends Controller { public function redirectToSocial(Social $social, $channel) { return $social->channel($channel)->redirect(); // return $social->channel($channel)->scopes(['scope1','scope2'])->redirect(); } public function handleSocialCallback(Social $social,$channel) { $user = $social->channel($channel)->user(); // $user->getToken(); // $user->getId(); // $user->getName(); // $user->getNickname(); // $user->getAvatar(); // $user->getEmail(); } }
统计信息
- 总下载量: 445
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 63
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2016-12-06