PHPackages                             bhhaskin/laravel-audit - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. bhhaskin/laravel-audit

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

bhhaskin/laravel-audit
======================

Audit trail package for Laravel applications with UUID support.

0.1.0(8mo ago)041MITPHPPHP ^8.1CI passing

Since Nov 2Pushed 8mo agoCompare

[ Source](https://github.com/bhhaskin/laravel-audit)[ Packagist](https://packagist.org/packages/bhhaskin/laravel-audit)[ RSS](/packages/bhhaskin-laravel-audit/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

Laravel Audit
=============

[](#laravel-audit)

Lightweight audit trail package for Laravel applications.

Features
--------

[](#features)

- Records `created`, `updated`, `deleted`, and `restored` events for any model.
- Stores both numeric primary keys and UUIDs for audits, auditable models, and users.
- Captures before/after state, request metadata, and user attribution.
- Ships with ready-to-run migrations plus publishable stubs and configuration.

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

[](#installation)

```
composer require bhhaskin/laravel-audit
```

Laravel auto-discovers the service provider. For older versions add `LaravelAudit\AuditServiceProvider::class` to the `providers` array in `config/app.php`.

### Publish Assets

[](#publish-assets)

```
php artisan vendor:publish --provider="LaravelAudit\AuditServiceProvider" --tag=laravel-audit-config
php artisan vendor:publish --provider="LaravelAudit\AuditServiceProvider" --tag=laravel-audit-migrations
```

Run the migration:

```
php artisan migrate
```

Usage
-----

[](#usage)

1. Add the `Auditable` trait to any Eloquent model that you want to track.
2. Ensure the model has a `uuid` column populated via the included `HasAuditUuid` trait or your own logic.

```
use Illuminate\Database\Eloquent\Model;
use LaravelAudit\Traits\Auditable;
use LaravelAudit\Traits\HasAuditUuid;

class Post extends Model
{
    use HasAuditUuid;
    use Auditable;
}
```

Audits are exposed through the `audits()` relationship:

```
$post = Post::first();

foreach ($post->audits as $audit) {
    echo $audit->uuid; // Frontend-friendly identifier
}
```

Configuration
-------------

[](#configuration)

Published configuration (`config/audit.php`) lets you:

- Enable/disable the logger or specific events.
- Ignore fields such as timestamps when diffing changes.
- Add default metadata and provide a custom user resolver.

The default user resolver defers to Laravel's `auth()` helper. Implement a custom resolver by binding a callable class and updating `user_resolver` in the config.

Events
------

[](#events)

Two framework events are fired for each audit lifecycle:

- `LaravelAudit\Events\AuditRecording` (before persistence) exposes the proposed payload for last-minute tweaks.
- `LaravelAudit\Events\AuditRecorded` (after persistence) includes the saved `Audit` model instance.

Listen for these events to trigger notifications, broadcast changes, or enrich metadata.

License
-------

[](#license)

MIT © Bryan

Testing
-------

[](#testing)

```
composer install
composer test
```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance62

Regular maintenance activity

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

243d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4709778?v=4)[Bryan Haskin](/maintainers/bhhaskin)[@bhhaskin](https://github.com/bhhaskin)

---

Top Contributors

[![bhhaskin](https://avatars.githubusercontent.com/u/4709778?v=4)](https://github.com/bhhaskin "bhhaskin (3 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/bhhaskin-laravel-audit/health.svg)

```
[![Health](https://phpackages.com/badges/bhhaskin-laravel-audit/health.svg)](https://phpackages.com/packages/bhhaskin-laravel-audit)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[spatie/laravel-health

Monitor the health of a Laravel application

87512.0M165](/packages/spatie-laravel-health)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k90.5k1](/packages/mike-bronner-laravel-model-caching)[api-platform/laravel

API Platform support for Laravel

58171.4k14](/packages/api-platform-laravel)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45444.2k1](/packages/pressbooks-pressbooks)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
