Hosmel Quintana
Laravel Audit Logs
Introduction
Installation
Configuration
Basic usage
Recording Audit Logs
Actors and Targets
Recording Attribute Changes
Querying Audit Logs
Testing Audit Logs
Advanced usage
Configuring Audit Context
Redacting Sensitive Data
Batching and Correlating Logs
Customizing the Audit Log Model
View on GitHub

Installation

Install Laravel Audit Logs and publish its configuration and migrations.

Requirements

Laravel Audit Logs requires PHP 8.4 or later and Laravel 12 or 13.

Install the package

Install the package with Composer:

bash
composer require hosmelq/laravel-audit-logs

Run the installer to publish the configuration file and migrations:

bash
php artisan audit-log:install

The installer offers to run the migrations. If you skip that step, run them yourself:

bash
php artisan migrate

The package publishes two migrations. The first creates the audit log table, and the second adds the attribute_changes column used for attribute changes. Run both.

Publish manually

To publish the files without the installer, run:

bash
php artisan vendor:publish --tag="audit-log-config"
php artisan vendor:publish --tag="audit-log-migrations"
php artisan migrate

The migrations read audit-log.storage.connection and audit-log.storage.table. Set those options before migrating if logs should not use the default connection or the audit_logs table. See configuration.

Next steps

Review the configuration, then record your first audit log.

IntroductionConfiguration