LaravelPackages.net
Acme Inc.
Toggle sidebar
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.

3.543
6
v1.2.0
About akira/laravel-auth-logs

akira/laravel-auth-logs is a Laravel package for track, query, and act on authentication activity in your laravel application. automatically records successful and failed sign-ins, with optional notifications and geolocation context.. It currently has 6 GitHub stars and 3.543 downloads on Packagist (latest version v1.2.0). Install it with composer require akira/laravel-auth-logs. Discover more Laravel packages by akira or browse all Laravel packages to compare alternatives.

Last updated

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.

Comments