Download the PHP package lab404/laravel-auth-checker without Composer
On this page you can find all versions of the php package lab404/laravel-auth-checker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download lab404/laravel-auth-checker
More information about lab404/laravel-auth-checker
Files in lab404/laravel-auth-checker
Package laravel-auth-checker
Short Description Laravel Auth Checker allows you to log users authentication, devices authenticated from and lock intrusions.
License MIT
Informations about the package laravel-auth-checker
Laravel Auth Checker
Laravel Auth Checker is a plugin to collect login info and devices used when a user authenticates. It makes it easy to catch user authentication attempts and lockouts from new IP address or new devices.
- Requirements
- Installation
- Usage
- Authenticatable model
- Logins
- Devices
- Events
- Tests
- Contributors
- Licence
Requirements
Version | Release |
---|---|
11 | 3.0 |
9, 10 | 2.0 |
8, 9 | 1.7 |
6, 7 | 1.6 |
Installation
- Require the package:
composer require lab404/laravel-auth-checker
- Publish migration files:
php artisan vendor:publish --tag=auth-checker
- Migrate your database:
php artisan migrate
- Configure your
Authenticatable
model (see below)
Usage
This library collects login data and devices data about your users.
Authenticatable model
Your Authenticatable
model (usually User
) must implement the HasLoginsAndDevicesInterface
interface.
The trait HasLoginsAndDevices
is provided with for a working default implementation.
Once configured, you can access the following methods
logins()
returns all loginsauths()
returns all successful login attempsfails()
returns all failed login attemptslockouts()
returns all lockouts
Each login returned is associated with the Device
model used
devices()
returns all devices used by the user to authenticate.
Logins
Calling $user->logins
outputs:
Also, you can directly access logins by their type
$user->auths
, returns successful logins (viaLogin::TYPE_LOGIN
)$user->fails
, returns failed logins (viaLogin::TYPE_FAILED
)$user->lockouts
, returns locked out logins (viaLogin::TYPE_LOCKOUT
)
Devices
Calling $user->devices
outputs:
Events
There are many events available that can be used to add features to your app
LoginCreated
is fired when a user authenticates.DeviceCreated
is fired when a new device is created for a user.FailedAuth
is fired when a user fails to log in.LockoutAuth
is fired when authentication is locked for a user (too many attempts).
Each event passes a Login
model and a Device
model to your listeners.
Tests
Contributors
- MarceauKa
- and all others contributors
Licence
MIT