akira/laravel-auth-logs
Composer 安装命令:
composer require akira/laravel-auth-logs
包简介
Track, query, and act on authentication activity in your Laravel application. Automatically records successful and failed sign-ins, with optional notifications and geolocation context.
README 文档
README
Laravel Authentication Logs
Laravel Authentication Logs records authentication activity for Laravel applications. It listens to Laravel authentication events, stores request context in a polymorphic log table, and sends mail notifications for security-relevant events.
Features
- Records successful login attempts.
- Records failed login attempts when Laravel provides a user instance.
- Marks the latest authentication log as logged out on user logout.
- Detects new devices by successful login history for the same IP address and user agent.
- Sends queued mail notifications for failed login and new device login events.
- Resolves optional geolocation context for notification messages.
- Supports configurable table name, database connection, events, listeners, templates, notification toggles, and retention value.
The package also subscribes to Laravel's OtherDeviceLogout event as a customization hook. The default listener does not write a log entry.
Requirements
- PHP 8.4 or higher
- Laravel 12.0 or 13.0
- An authenticatable model that uses Laravel notifications
The test workflow validates both Laravel 12 and Laravel 13 dependency sets.
Installation
Install the package with Composer:
composer require akira/laravel-auth-logs
Publish the configuration and migration:
php artisan auth-logs:install php artisan migrate
Add the AuthLogs trait to your authenticatable model:
use Akira\LaravelAuthLogs\Concerns\AuthLogs; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; class User extends Authenticatable { use Notifiable, AuthLogs; }
Documentation
Full documentation is available under docs/:
- Installation
- Configuration
- Usage
- Notifications
- Architecture
- Data Flow
- Security
- Advanced Usage
- API Reference
- Operations
- Testing
- Troubleshooting
- FAQ
- Roadmap
Testing
composer test
The full gate runs Pint, Rector dry-run, PHPStan, Pest type coverage, and Pest coverage.
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.
统计信息
- 总下载量: 3.06k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-01-30
