akira/laravel-auth-logs 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

Latest Version on Packagist Total Downloads PHPStan Level License img.png

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/:

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

GitHub 信息

  • Stars: 6
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固