PHP code example of yunwuxin / think-social
1. Go to this page and download the library: Download yunwuxin/think-social library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
yunwuxin / think-social example snippets
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();
}