Skip to content

lamalamaNL/laravel-login-attempts

Repository files navigation

Laravel Login Attempts

Latest Version on Packagist Software License StyleCI Total Downloads

Register unique login attempts and get notified of suspicious attempts via email.

Install

Via Composer

$ composer require lamalama/laravel-login-attempts

You can publish the migration with:

php artisan vendor:publish --provider="LamaLama\LoginAttempts\LoginAttemptsServiceProvider" --tag="migrations"

After publishing the migration you can create the login_attempts table by running the migrations:

php artisan migrate

You can optionally publish the config file with:

php artisan vendor:publish --provider="LamaLama\LoginAttempts\LoginAttemptsServiceProvider" --tag="config"

Use

Add the LamaLama\LoginAttempts\Listeners\AuthEventSubscriber to the $subscribe variable in the app/Providers/EventServiceProvider.php file.

/**
 * The subscriber classes to register.
 *
 * @var array
 */
protected $subscribe = [
    'LamaLama\LoginAttempts\Listeners\AuthEventSubscriber',
];

Set the email addresses which shoud receive notifications in your .env file:

LOGIN_ATTEMPTS_EMAIL="laravel@lamalama.nl, laravel@lamalama.com"

Commands

Clear all login attempts in the database

php artisan login-attempts:clear

Clear all failed login attempts in the database

php artisan login-attempts:clear-failed

Clear all login succeeded attempts in the database

php artisan login-attempts:clear-succeeded

Change log

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.