1. Go to this page and download the library: Download lcobucci/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/ */
lcobucci / social example snippets
// client_config.php
\Providers\Github;
use Lcobucci\Social\AuthClient;
use Lcobucci\Social\Providers\Facebook;
$client = new AuthClient();
$client->appendProvider(
'github', // The provider identifier (anything you may want)
Github::create(
'blablabla', // The client ID
'blablabla', // The client secret
'http://blablabla.com/oauth/github/callback.php'// The callback URI (if you want...)
['user:email'] // The default scopes (if you want...)
)
);
return $client
// init.php
$client = thorizationUri(
'github', // The provider identifier you want to use (that you configured before)
[], // Additional scopes (if you want...)
uniqid() // State to be validated (if you want...)
);
header('Location: ' . $uri);
// callback.php
use Symfony\Component\HttpFoundation\Request;
$client = tedUser('github', $request->query);
var_dump($user->getToken()); // Get the access token that should be used on API requests
var_dump($user->getId()); // Get the user ID
var_dump($user->getUsername()); // Get the user login
var_dump($user->getName()); // Get the user name
var_dump($user->getEmail()); // Get the user email
var_dump($user->getAvatar()); // Get the user avatar
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.