Looking to hire Laravel developers? Try LaraJobs

laravel-unusual-login maintained by webhubworks

Description
This is my package laravel-unusual-login
Author
Last update
2026/04/11 07:24 (dev-main)
License
Downloads
128

Comments
comments powered by Disqus

Installation

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.