acidjazz/humble

Ideal Authentication for Laravel

v1.0.16 2018-10-14 00:08 UTC

README

logo.jpg

Ideal Sessioning and authentication for Laravel

Packagist License Latest Stable Version Total Downloads

Features

  • Passwordless authentication
    • Ability to store and compare a cookie, securing the magic link sent out
    • Ability for magic links to expire
  • Detailed sessions using whichbrowser
"device": {
  "string": "Chrome 68 on a Google Pixel 2 XL running Android 9",
  "platform": "Android 9",
  "browser": "Chrome 68",
  "name": "Google Pixel 2 XL",
  "desktop": false,
  "mobile": true
}
"location": {
  "ip": "86.222.88.167",
  "country": "France",
  "city": "Lons",
  "state": "NAQ",
  "postal_code": "64140",
  "lat": 43.3167,
  "lon": -0.4,
  "timezone": "Europe\/Paris",
  "currency": "EUR"
}

Installation

Install humble with composer:

composer require acidjazz/humble

Add Humble's trait to your user model:

use acidjazz\Humble\Traits\Humble;
...
class User extends Authenticatable
{
  use Humble, Notifiable;
}

Publish Humble's migrations of it's sessions table

php artisan vendor:publish --tag="humble.migrations"

Run the migration

php artisan migrate

Change your guard in your config, to the 'humble' guard in config/auth.php, in my case since I mainly use Laravel as an API

    'guards' => [
        'web' => [
            'driver' => 'session',
            'provider' => 'users',
        ],

        'api' => [
            'driver' => 'humble',
            'provider' => 'users',
        ],
    ],

If you're user class is not App\User, we need to tell humble what it is:

Publish Humble's configuration

php artisan vendor:publish --provider="acidjazz\Humble" --tag=config

Modify config/humble.php and specify your user class