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(6mo ago)025MITPHPPHP ^8.1CI passing

Since Nov 2Pushed 6mo 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 1mo ago

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

30

—

LowBetter than 64% of packages

Maintenance67

Regular maintenance activity

Popularity8

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

191d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ec33fc092098e1dd582f55e8d1c82c6ebe2b472302f909f82d70235c7c665ff8?d=identicon)[bhhaskin](/maintainers/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

[spatie/laravel-activitylog

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

5.8k45.4M309](/packages/spatie-laravel-activitylog)[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[yadahan/laravel-authentication-log

Laravel Authentication Log provides authentication logger and notification for Laravel.

416632.8k5](/packages/yadahan-laravel-authentication-log)[directorytree/metrics

Record metrics in your Laravel application

26027.8k](/packages/directorytree-metrics)[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[masterro/laravel-mail-viewer

Easily view in browser outgoing emails.

6392.1k](/packages/masterro-laravel-mail-viewer)

PHPackages © 2026

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