Skip to content

Commit fcad28b

Browse files
committed
Update readme
1 parent 2988c8c commit fcad28b

File tree

1 file changed

+86
-9
lines changed

1 file changed

+86
-9
lines changed

readme.md

Lines changed: 86 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Laravel Socialite
1+
<p align="center"><img src="https://pix.watch/KMqGF4/v0Yo15.png"></p>
22

33
[![Latest Version on Packagist][ico-version]][link-packagist]
44
[![Total Downloads][ico-downloads]][link-downloads]
@@ -7,13 +7,13 @@
77

88
## Introduction
99

10-
:octocat: Social OAuth authentication for Laravel 5. Drivers: Facebook, Twitter, Google, LinkedIn, Github. This package use [https://github.com/laravel/socialite](Laravel Socialite).
10+
Social OAuth authentication for Laravel 5. Drivers: Facebook, Twitter, Google, LinkedIn, Github. This package use [https://github.com/laravel/socialite](Laravel Socialite).
1111

1212
## Installation
1313

1414
1. Include the package in your project using Composer
1515

16-
``` bash
16+
``` shell
1717
$ composer require mckenziearts/laravel-socialite
1818
```
1919

@@ -27,23 +27,100 @@
2727

2828
3. Publish the Vendor Assets files by running:
2929

30-
```bash
30+
```shell
3131
php artisan vendor:publish --provider="Mckenziearts\LaravelSocialite\LaravelSocialiteServiceProvider"
3232
```
3333

3434
4. Now that we have published a few new files to our application we need to reload them with the following command:
3535

36-
```bash
36+
```shell
3737
composer dump-autoload
3838
```
3939

40+
## Configuration
41+
42+
When you published the vendor assets you added a new file inside of your `config` folder which is called `config/laravel-socialite.php`. This file contains a bunch of configuration you can use to configure your connexion using social networks.
43+
44+
First, you have to add your service like is defined on The official documentation of Socialite [https://laravel.com/docs/5.6/socialite#configuration](available here). Just setup your
45+
Oauth services for your application. Laravel/socialite is automatically installed by this package.
4046

4147
## Usage
4248

49+
1. Fisrt of all in the `config/laravel-socialite.php` file you must define the default users table name to simplify migrations. By default users table is used
50+
51+
```php
52+
'users' => [
53+
'table' => 'users',
54+
],
55+
```
56+
57+
2. Secondly you must specify the providers to use for social login in the `providers` array. To active a provider set the value to `true`
58+
59+
```php
60+
'providers' => [
61+
'facebook' => true,
62+
'google' => true,
63+
'github' => true,
64+
],
65+
```
66+
67+
The last configuration is to stylize the button by editing class name and add or remove icon
68+
69+
![](https://pix.watch/m3qMiw/Q8fKIi.png)
70+
71+
Next, if you may want to re-publish the laravel-socialite assets, config, and the migrations run the following command:
72+
73+
```
74+
php artisan vendor:publish --tag=laravelsocialite.assets --force
75+
php artisan vendor:publish --tag=laravelsocialite.config --force
76+
php artisan vendor:publish --tag=laravelsocialite.migrations --force
77+
```
78+
79+
3. Next to make sure you have the latest database schema run:
80+
81+
```
82+
php artisan migrate
83+
```
84+
85+
4. Inside of your master.blade.php file include a header yield. Inside the head of your master or app.blade.php add the following:
86+
87+
```
88+
@yield('css')
89+
```
90+
91+
5. Add the blade directive to your view where you want to display the socials buttons. The directive takes a parameter `login` to display the login text or `resgister` for the text related to the registration
92+
93+
```
94+
@socialite('login')
95+
```
96+
97+
6. Add the style of the buttons by adding this to your view in the section in the `@yield('css')` who defined in your master layout
98+
99+
```
100+
@section('css')
101+
<link href="{{ url('/vendor/mckenziearts/laravelsocialite/assets/css/socialite.css') }}" rel="stylesheet">
102+
@endsection
103+
```
104+
105+
7. In the `Auth\LoginController` of your application, add the `OAuthSocialite` trait:
106+
107+
```php
108+
namespace App\Http\Controllers\Auth;
109+
110+
use App\Http\Controllers\Controller;
111+
use Illuminate\Foundation\Auth\AuthenticatesUsers;
112+
use Mckenziearts\LaravelSocialite\Traits\OAuthSocialite;
113+
114+
class LoginController extends Controller
115+
{
116+
use OAuthSocialite;
117+
..
118+
```
119+
With this feature you can overwrite the present methods on the trait if you want to customize them even more
43120

44121
## Change log
45122

46-
Please see the [changelog](changelog.md) for more information on what has changed recently.
123+
Please see the [changelog.md](changelog.md) for more information on what has changed recently.
47124

48125
## Testing
49126

@@ -61,12 +138,12 @@ If you discover any security related issues, please email monneylobe@gmail.com i
61138

62139
## Credits
63140

64-
- [Arthur Monney][link-author]
65-
- [All Contributors][link-contributors]
141+
- [Arthur Monney][https://www.twitter.com/monneyarthur]
142+
- [Laravel Socialite][https://laravel.com/docs/5.6/socialite]
66143

67144
## License
68145

69-
MIT. Please see the [license file](license.md) for more information.
146+
MIT. Please see the [license.md](license.md) for more information.
70147

71148
[ico-version]: https://img.shields.io/packagist/v/mckenziearts/laravel-socialite.svg?style=flat-square
72149
[ico-downloads]: https://img.shields.io/packagist/dt/mckenziearts/laravel-socialite.svg?style=flat-square

0 commit comments

Comments
 (0)