Download the PHP package aspirin1988/socialite without Composer
On this page you can find all versions of the php package aspirin1988/socialite. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download aspirin1988/socialite
More information about aspirin1988/socialite
Files in aspirin1988/socialite
Download aspirin1988/socialite
More information about aspirin1988/socialite
Files in aspirin1988/socialite
Vendor aspirin1988
Package socialite
Short Description Laravel 5 socialite VK.com Mail.ru OK.ru
License MIT
Homepage https://github.com/aspirin1988/socialite
Package socialite
Short Description Laravel 5 socialite VK.com Mail.ru OK.ru
License MIT
Homepage https://github.com/aspirin1988/socialite
Please rate this library. Is it a good library?
Informations about the package socialite
Авторизация через социальные сети
VK | Mail.ru | Ok.ru
Установка
composer require aspirin1988/socialite
Затем добавьте в: /app/Providers/AppServiceProvider.php
в фунцию boot(){
..//..//..
$this->bootVkontakte();
$this->bootMailru();
$this->bootOKru();
}
Добавляем ниже эти функции:
private function bootVkontakte()
{
$socialite = $this->app->make('Laravel\Socialite\Contracts\Factory');
$socialite->extend(
'vkontakte',
function ($app) use ($socialite) {
$config = $app['config']['services.vkontakte'];
return $socialite->buildProvider(VkontakteProvider::class, $config);
}
);
}
private function bootMailRu()
{
$socialite = $this->app->make('Laravel\Socialite\Contracts\Factory');
$socialite->extend(
'mailru',
function ($app) use ($socialite) {
$config = $app['config']['services.mailru'];
return $socialite->buildProvider(MailruProvider::class, $config);
}
);
}
private function bootOKru()
{
$socialite = $this->app->make('Laravel\Socialite\Contracts\Factory');
$socialite->extend(
'okru',
function ($app) use ($socialite) {
$config = $app['config']['services.okru'];
return $socialite->buildProvider(OKruProvider::class, $config);
}
);
}
А так же в /config/services.php добавляем соответствующие секции:
'vkontakte' => [
'client_id' => APP_ID,
'client_secret' => APP_SECRET,
'redirect' => APP_REDIREDT_URL,
],
'mailru' => [
'client_id' => APP_ID,
'client_secret' => APP_SECRET,
'redirect' => APP_REDIREDT_URL,
],
'okru' => [
'client_id' => APP_ID,
'client_public' => APP_PUBLIcK_KEY,
'client_secret' => APP_SECRET,
'redirect' => 'APP_REDIREDT_URL,
],
Использование
Пример вызова:
/*Вызов метода авторизации через VK*/
public function authVkontakte()
{
return Socialite::driver('vkontakte')->redirect();
}
/*Получение и вывод данных пользователя VK*/
public function authVkontakteCallback()
{
$user = Socialite::driver('vkontakte')->user();
return response()->json($user);
}
All versions of socialite with dependencies
PHP Build Version
Package Version
The package aspirin1988/socialite contains the following files
Loading the files please wait ....