2017 © Pedro Peláez
 

think-extend think-social

ThinkPHP5 Social Library

image

myxland/think-social

ThinkPHP5 Social Library

  • Monday, January 15, 2018
  • by myxland
  • Repository
  • 1 Watchers
  • 1 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Thinkphp5.1 社会化登陆

安装

composer require myxland/think-social:dev-master
php think social:config

用法

1、控制器, (*1)

<?php

namespace app\index\controller;

use think\Controller;

use myxland\social\Social;

class Auth extends Controller
{
    public function redirectToSocial($channel)
    {
        return Social::channel($channel)->redirect();
    }

    public function handleSocialCallback($channel)
    {
        $user = Social::channel($channel)->user();

        // $user->getToken();
        // $user->getId();
        // $user->getName();
        // $user->getNickname();
        // $user->getAvatar();
        // $user->getEmail();
    }
}

2、定义路由, (*2)

Route::get('auth/:channel/callback', 'Auth/handleSocialCallback');
Route::get('auth/:channel', 'Auth/redirectToSocial');

The Versions

15/01 2018

dev-master

9999999-dev

ThinkPHP5 Social Library

  Sources   Download

Apache-2.0

The Requires

 

by HWJ