1. Go to this page and download the library: Download freebuu/socialite-local 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/ */
freebuu / socialite-local example snippets
Socialite::driver('github')->redirect()
Socialite::driver('github')->user()
public function register()
{
$this->app->afterResolving('socialite_local.subject_repository', function ($r){
$r->setUserCallback(function ($data){
//data is array coming from login form
//return array with user info
return [
'id' => $data['id'] ?? random_int(1000, 10000),
'uuid' => $data['uuid'] ?? vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex(random_bytes(16)), 4)),
'email' => $email = $data['email'],
'username' => $data['username'] ?? $email,
'name' => $data['name'] ?? mb_substr($email, 0, strpos($email, '@')) . '_name',
];
});
});
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.