webhubworks / laravel-unusual-login
This is my package laravel-unusual-login
Fund package maintenance!
webhubworks
Installs: 26
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/webhubworks/laravel-unusual-login
Requires
- php: ^8.1
- illuminate/contracts: ^10.0||^11.0||^12.0
- jenssegers/agent: ^2.6
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^10.0.0||^9.0.0||^8.22.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-arch: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
- spatie/laravel-ray: ^1.35
README
You can install the package via composer:
composer require webhubworks/laravel-unusual-login
You can publish the config and migration files with:
php artisan unusual-login:install
Finally, you can run the migrations with:
php artisan migrate
Alternatively, you can publish the config file only with:
php artisan vendor:publish --tag="unusual-login-config"
Usage
This package listens to the Illuminate\Auth\Events\Attempting and Illuminate\Auth\Events\Login events.
On the Login event it will run through the checks defined in the config file.
If the specified threshold is reached, the package will fire the Webhubworks\LaravelUnusualLogin\Events\UnusualLoginDetected event.
Additionally, you may specify a notification the package will automatically send out.
You may create custom checks. Simply refer to a given check in src/Checks.
Your check must extend the Webhubworks\LaravelUnusualLogin\Checks\Check class and implement the handle method.
It receives and returns the WebhubWorks\UnusualLogin\DTOs\UnusualLoginDetected DTO object.
Cleaning / Purging
< Laravel 11.0
In the Kernel.php file add the following to the schedule method:
// in app/Console/Kernel.php use Webhubworks\LaravelUnusualLogin\Commands\PurgeLoginAttemptsCommand; protected function schedule(Schedule $schedule) { $schedule->command(PurgeLoginAttemptsCommand::class)->daily(); }
>= Laravel 11.0
On the routes/console.php add the following lines:
use Webhubworks\LaravelUnusualLogin\Commands\PurgeLoginAttemptsCommand; Schedule::command(PurgeLoginAttemptsCommand::class)->daily();
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.