summaryrefslogtreecommitdiffstats
path: root/docs/providers.md
blob: df6d951bb9b477b85155d65ffa7265ad9f9e154c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Providers

## Laravel 4

**NOTE:** The current Laravel support is for 4.x based versions.

A Laravel authentication provider is included with the Gatekeeper package in `Psecio\Gatekeeper\Provider\Laravel`.
It's easy to add into your Laravel application and seamlessly works with the framework's `Auth` handling.

**Step 1:** Add the database configuration into your `app/config/database.php` file:

```
'gatekeeper' => array(
    'driver' => 'mysql',
    'host' => 'localhost',
    'database' => 'gatekeeper',
    'username' => 'your-username',
    'password' => 'your-password',
    'charset'   => 'utf8',
    'collation' => 'utf8_unicode_ci',
    'prefix'    => '',
)
```

**Step 2:** In the `app/start/global.php` file, add the following to inject the provider and make it available:

```php
<?php

Auth::extend('gatekeeper', function($app) {
    return new \Psecio\Gatekeeper\Provider\Laravel();
});

?>
```

**Step 3:** Finally, in your `app/config/auth.php` file, change the `driver` value to "gatekeeper":

```php
'driver' => 'gatekeeper'
```