gsdw/social

Laravel 社交连接

v0.1.0 2016-05-11 03:27 UTC

This package is not auto-updated.

Last update: 2024-09-14 19:04:07 UTC


README

简介

安装

add code to composer.json

"require": {
    "laravel/socialite": "^2.0",
    "gsdw/social": "0.1.*"
}

配置

在您的 config/app.php 配置文件中注册 Provider

'providers' => [
    // Other service providers...
    Laravel\Socialite\SocialiteServiceProvider::class,
    Gsdw\Social\Providers\SocialServiceProvider::class,
],

此外,将 Socialite 门面添加到 app 配置文件中的 aliases 数组

'Socialite' => Laravel\Socialite\Facades\Socialite::class,

config/services.php 配置文件中添加应用程序信息

'google' => [
    'client_id' => 'your-github-app-id',
    'client_secret' => 'your-github-app-secret',
    'redirect' => url('social/handle/google'),
],

添加链接登录

默认的社会化登录链接为 /social/redirect/google。可以使用 html 输出链接:\Gsdw\Social\Helpers\Output::googleButton()

通知

在布局中添加代码以显示通知 @if (count($errors) > 0) <ul> @foreach ($errors->all() as $error) <li>{{ $error }}</li> @endforeach </ul> @endif

参考

https://github.com/laravel/socialite