smony/filament-login-attempts
Composer 安装命令:
composer require smony/filament-login-attempts
包简介
Log login attempts to your Filament admin panel and protect it from brute-force attacks.
README 文档
README
Log every login attempt to your Filament admin panel and lock out brute-force attackers automatically, right from your Filament admin panel.
Requirements
- PHP 8.2+
- Filament v4
Installation
composer require smony/filament-login-attempts
Publish and run the migration:
php artisan vendor:publish --tag=filament-login-attempts-migrations php artisan migrate
Register the plugin in your Panel Provider:
use Smony\FilamentLoginAttempts\FilamentLoginAttemptsPlugin; public function panel(Panel $panel): Panel { return $panel // ... ->plugin(FilamentLoginAttemptsPlugin::make()); }
What you get
- A Login Attempts page listing every login attempt: email, matched user (or "Guest"), IP address, parsed device/browser, success/failure, and when it happened
- Brute-force protection: after a configurable number of failed attempts, the offending IP, email, or IP+email combination is locked out for a configurable duration — enforced via Laravel's
RateLimiter, the same mechanism behind the framework's own login throttling - A "Currently locked out" filter and an "Unlock now" action to lift a lockout early
- A stats widget showing failed attempts in the last 24 hours and how many keys are currently locked out
- A
login-attempts:pruneartisan command to delete attempts older than your retention window - A
Smony\FilamentLoginAttempts\Events\LoginLockedOutevent, dispatched the moment a key gets locked out — listen for it in your app to send your own notification (Slack, email, etc.):
use Smony\FilamentLoginAttempts\Events\LoginLockedOut; Event::listen(LoginLockedOut::class, function (LoginLockedOut $event) { // $event->key, $event->email, $event->ipAddress, $event->lockedForMinutes });
Configuration
Publish the config to customize thresholds, the lockout key strategy, and retention:
php artisan vendor:publish --tag=filament-login-attempts-config
return [ 'table' => 'login_attempts', 'max_attempts' => 5, 'decay_minutes' => 10, 'lockout_minutes' => 15, 'lockout_strategy' => 'ip_and_email', // ip | email | ip_and_email 'retention_days' => 30, ];
Schedule the prune command in your app's console kernel/scheduler to keep the table from growing indefinitely:
$schedule->command('login-attempts:prune')->daily();
License
MIT
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-04
