Model or dataset
owen-it/laravel-auditing avatar
owen-it/laravel-auditing

owen-it/laravel-auditing: model change history in Laravel through a trait

Record the change log from models in Laravel

3,465 stars410 forksPHPMIT

At a glance

What is it?
Laravel Auditing records Eloquent model changes by attaching a trait and an observer, then stores each revision in an audits table. It fits teams that need a queryable per-model change log inside the application database.
Who is it for?
Adopt owen-it/laravel-auditing when you need a queryable, per-model change history inside your own Laravel database and you are on Illuminate 11.x through 13.x with PHP 8.2 or newer. Do not adopt it as a security log for authentication events, and do not adopt it if your models are written outside Eloquent, because the mechanism depends on model events.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 12 days ago.
What is it written in?
Mainly PHP, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 26, 2026, and from our analysis. They are not legal advice.

Editorial analysis

The problem it solves: an Eloquent change log without hand-written observers

Most Laravel applications eventually need to answer a question the current row cannot answer: who changed this record, when, and from what. The usual first attempt is a set of model observers that write to a log table on updated and deleted. That works until you have twelve models, each observer drifts, and nobody records the old values consistently.

Laravel Auditing packages that pattern. The README describes it as keeping a history of model changes by using a trait, with retrieval that is meant to be straightforward so the data can be displayed in different ways. The audience is Laravel developers who already use Eloquent and want the audit data in the same database as the application, queryable through the same models and query builder.

It is not aimed at teams who want to ship application logs to an external store, and it is not an authentication or access log. Those are different problems with different retention and tamper-resistance requirements.

How the trait and observer produce an audit record

The mechanism is an Eloquent trait plus an observer. You add the trait to a model, and the package's observer listens to the model events. On a write, the package compares the model's current attribute values with the original values it held before the write, and stores the difference as an audit entry. That entry is itself an Eloquent model, which is why retrieval looks like any other query in your application.

The repository layout supports this reading: src/ holds the package code, config/ holds the published configuration, database/ holds the migration that creates the audits table, and stubs/ holds templates used by the install command. The package sits on top of Eloquent's event system rather than on database triggers, so anything that bypasses model events, such as raw SQL updates or bulk queries that Eloquent does not hydrate, produces no audit entry.

Version 14.x is listed as supporting Illuminate 11.x through 13.x and PHP 8.2 or newer. Every earlier line in the README's version table is marked end of life, including 13.x, which supported Illuminate 7.x through 11.x. If you are on an older Laravel release, the version table is the place to check before anything else.

Installing owen-it/laravel-auditing and auditing your first model

The README gives no install commands of its own. It states that the package is installed from Packagist under the name owen-it/laravel-auditing and sends the reader to laravel-auditing.com and to the repository documentation file for detailed instructions on installing and using it. The repository layout backs that up: composer.json, a config/ directory, a database/ directory with the migration, and a stubs/ directory that the install command publishes from.

The one thing the README does spell out is the version pairing. Version 14.x is listed against Illuminate 11.x through 13.x and PHP 8.2 or newer, and every earlier row in the table is marked end of life. Check that table first, because installing 14.x on an older Laravel release is the failure mode the table exists to prevent.

For the actual commands, follow the documentation rather than guessing. The README's own pointer is the authoritative source:

code
http://laravel-auditing.com/docs/master/contributing

Once the package is in place, the usage model is a trait plus a contract on each model you want tracked, and the audit entries are retrievable as Eloquent models. The README does not print the trait's namespace or the publish command, so take both from the documentation page before you edit any model.

Where the audit trail stops: model events are the boundary

The clearest limitation follows from the design. Because auditing is driven by Eloquent model events, writes that do not pass through the model lifecycle are invisible. A raw update statement, a truncate, a data fix run directly against the database, or a bulk operation that Eloquent does not hydrate will not appear in the audits table. If your compliance story depends on capturing every mutation of a table, this package cannot guarantee that on its own.

The second constraint is volume. Every audited write adds rows to a single audits table in your application database. The README does not document a retention policy or a pruning command, so growth management is your responsibility, and the audits table will compete for the same database resources as your application data.

The third is scope. The README frames the package around model changes and the discrepancies they may indicate. It does not present itself as an authentication log, a request log, or a security event system, and adopting it for those purposes would mean building the missing parts yourself.

Laravel Auditing compared with Laravel activity log packages

The common alternative in this space is an activity log package, and the related searches show people comparing the two directly. The difference is what gets recorded and who decides.

An activity log is typically driven by explicit calls in your application code: you decide at each point in a controller or service that something worth logging happened, and you describe it in your own words. That gives you a human-readable narrative, including events that are not model writes, but it depends on developers remembering to call it and on the descriptions staying consistent.

Laravel Auditing inverts that. You attach a trait, and the recording happens automatically at the model layer, capturing old and new attribute values without per-action code. The trade-off is that you get field-level diffs rather than narrative descriptions, and you get nothing for events that are not model changes. A team that wants a readable feed of business events will find the activity log approach closer to what they want; a team that wants to reconstruct the state of a record over time will find the trait approach closer.

Maintenance, version support and the MIT licence

The repository is not archived, and the last push was on 2026-09-18. Recent tagged releases are v14.0.6 on 2026-06-20, v14.0.5 on 2026-06-18 and v14.0.4 on 2026-06-12. The README's version table marks 14.x as active support and every earlier line as end of life.

The practical upgrade cost is tied to that table. Version 14.x targets Illuminate 11.x through 13.x and PHP 8.2 or newer, so upgrading Laravel past the supported range, or staying on an older Laravel release, puts you outside the maintained line. The repository ships phpstan.neon.dist, phpunit.xml, .pint.json and .styleci.yml, which indicates static analysis, a test suite and code style tooling are part of the project's own workflow; that says nothing about whether your application's models will pass, only that the package is checked on its side.

The package is MIT licensed. In practice that permits commercial and closed-source use, but it comes with no warranty, and the licence text in LICENSE.md is the authority rather than any summary. Nothing here is legal advice; if your audit data is subject to a regulatory retention rule, that obligation sits with your application, not with the package.

Editorial conclusion

Adopt owen-it/laravel-auditing when you need a queryable, per-model change history inside your own Laravel database and you are on Illuminate 11.x through 13.x with PHP 8.2 or newer. Do not adopt it as a security log for authentication events, and do not adopt it if your models are written outside Eloquent, because the mechanism depends on model events. Before rolling it out, verify on a copy of your schema that the audits migration runs against your database engine, and confirm how you will prune the audits table once it grows.

Frequently asked questions

What does 'auditable' mean in owen-it/laravel-auditing?

It is the contract a model implements to opt into auditing, alongside the trait that supplies the behaviour. In the package's naming these are the Auditable contract and the AuditingTrait, and a model that implements the contract and uses the trait has its changes recorded.

How do I build an audit trail with owen-it/laravel-auditing?

Attach the trait and the Auditable contract to the models you want tracked, and the package's observer records their changes into the audits table. The README directs readers to laravel-auditing.com and the repository documentation file for the full instructions.

What is Laravel used for in the context of owen-it/laravel-auditing?

The package is built for Laravel applications that use Eloquent models, and it hooks into Eloquent's model events to record changes. Version 14.x supports Illuminate 11.x through 13.x with PHP 8.2 or newer.

What is the difference between audit and review when using owen-it/laravel-auditing?

The package records model changes automatically as audit entries in the audits table; it does not provide a review workflow on top of them. The README says the audited data is straightforward to retrieve and can be displayed in various ways, which is where review would be built.

Official sources

  1. License: MIT
  2. owen-it/laravel-auditing on GitHub
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/owen-it-laravel-auditing.svg)](https://hysenlabs.com/projects/owen-it-laravel-auditing)