PHPackages                             lunnar/laravel-audit-logging - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. lunnar/laravel-audit-logging

ActiveLibrary[Database &amp; ORM](/categories/database)

lunnar/laravel-audit-logging
============================

Comprehensive audit logging for Laravel: model events, HTTP requests, outgoing API calls, and request tracing with integrity verification

v1.7.0(5mo ago)0477MITPHPPHP ^8.2

Since Nov 28Pushed 5mo agoCompare

[ Source](https://github.com/BeakSoftware/laravel-audit-logging)[ Packagist](https://packagist.org/packages/lunnar/laravel-audit-logging)[ RSS](/packages/lunnar-laravel-audit-logging/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependencies (4)Versions (13)Used By (0)

Laravel Audit Logging
=====================

[](#laravel-audit-logging)

Comprehensive audit logging for Laravel: model events, HTTP requests, outgoing API calls, and request tracing with integrity verification.

Features
--------

[](#features)

- 🔄 Automatic logging of `created`, `updated`, and `deleted` events
- 🎯 Per-model configuration via static properties
- 🔗 Auto-detection of `BelongsTo` relationships as parent subjects
- 🔒 Automatic sanitization of sensitive data (passwords, tokens, etc.)
- 🔐 HMAC checksum for data integrity verification
- 📡 HTTP request logging with full request/response capture
- 📤 Outgoing HTTP request logging (Laravel HTTP client)
- 🔍 Request tracing via `reference_id` linking requests to audit events
- 🗑️ Separate configurable retention policies for events, requests, and outgoing requests
- 👁️ Event levels for visibility control (show different events to different user types)

Installation
------------

[](#installation)

```
composer require lunnar/laravel-audit-logging
```

Publish the config and migrations:

```
php artisan vendor:publish --tag=audit-logging-config
php artisan vendor:publish --tag=audit-logging-migrations
php artisan migrate
```

Add the `AUDIT_KEY` to your `.env` file:

```
AUDIT_KEY=your-secure-random-string-here
```

Generate a secure key:

```
php artisan tinker --execute="echo bin2hex(random_bytes(32));"
```

Usage
-----

[](#usage)

Add the `HasAuditLogging` trait to any model you want to audit:

```
