coloredcow/laravel-audit

Audit Logs for Laravel
531 4
Install
composer require coloredcow/laravel-audit
Latest Version:2.0.2
PHP:^8.2
License:GPL-3.0+
Last Updated:Feb 15, 2025
Links: GitHub  ·  Packagist
Maintainer: coloredcow

Audit Logs for Laravel

A package to capture system activity in a Laravel application. Currently supports the following fields:

  • IP of HTTP request,
  • HTTP referer,
  • a description of the action you want to audit.
  • user id
  • Other details like data and keys

Installation

  1. Run composer require coloredcow/laravel-audit
  2. Add the ColoredCow\LaravelAudit\AuditServiceProvider to config/app.php
'providers' => [
    ColoredCow\LaravelAudit\AuditServiceProvider::class
];
  1. Run php artisan migrate

Usage

  1. Use the ColoredCow\LaravelAudit\Events\Auditable trait in the events you want to audit. And add this to the contructor of the event.
$this->setAudit([
    'ip' => 'ip-of-user-here',
    'referer' => 'referer-address',
    'action' => 'description of event and action being audited'
]);
  1. Use the ColoredCow\LaravelAudit\Listeners\AuditActivities listener to listen to the events to want to audit. Map it in the EventServiceProvider of your laravel application.

Audit Facade

  1. Add AuditFacade in your app to make a audit directly from the applications.
 AuditFacade::make(['action' => 'Audit Action']);
  1. You can also overide other properties like ip, userid and descriptions.
 AuditFacade::make(['action' => 'Audit Action', 'ip' => 'My IP']);

Related Packages

understand/understand-laravel

Laravel service provider for Understand.io

113,033 24
jeylabs/laravel-audit-log

A very simple audit logger to monitor the users of your website or application

5,490 6
venturecraft/revisionable

Keep a revision history for your models without thinking, created as a package f...

7,333,915 2,614
understand/understand-laravel5

Laravel 5, 6, 7 and 8 service provider for Understand.io

589,590 24