PHPackages                             yajra/laravel-auditable - 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. yajra/laravel-auditable

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

yajra/laravel-auditable
=======================

A simple Laravel user auditing package for Eloquent Model.

v13.0.0(3mo ago)173271.3k↓26.3%25[1 issues](https://github.com/yajra/laravel-auditable/issues)[1 PRs](https://github.com/yajra/laravel-auditable/pulls)3MITPHPPHP ^8.3CI passing

Since Jun 13Pushed 3mo ago3 watchersCompare

[ Source](https://github.com/yajra/laravel-auditable)[ Packagist](https://packagist.org/packages/yajra/laravel-auditable)[ Docs](https://github.com/yajra/laravel-auditable)[ GitHub Sponsors](https://github.com/sponsors/yajra)[ RSS](/packages/yajra-laravel-auditable/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (9)Dependencies (16)Versions (36)Used By (3)

Laravel Auditable
=================

[](#laravel-auditable)

[![Latest Version on Packagist](https://camo.githubusercontent.com/4461452249c89172a1b893c30e97e348f40bf3813c54f2a93bb46a9e36f1544d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f79616a72612f6c61726176656c2d617564697461626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/yajra/laravel-auditable)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

[![Continuous Integration](https://github.com/yajra/laravel-auditable/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/yajra/laravel-auditable/actions/workflows/continuous-integration.yml)[![Static Analysis](https://github.com/yajra/laravel-auditable/actions/workflows/static-analysis.yml/badge.svg)](https://github.com/yajra/laravel-auditable/actions/workflows/static-analysis.yml)[![Total Downloads](https://camo.githubusercontent.com/5115f89179b63f36adb4460029ce65756236e2d103b27a002a047476b7f47d20/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f79616a72612f6c61726176656c2d617564697461626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/yajra/laravel-auditable)

Laravel Auditable is a simple Laravel auditing package for your Eloquent Model. This package automatically inserts/updates an audit log on your table on who created and last updated the record.

Laravel Version Compatibility
-----------------------------

[](#laravel-version-compatibility)

LaravelPackage5.x-10.x4.x11.x11.x12.x12.x13.x13.xInstall via Composer
--------------------

[](#install-via-composer)

```
composer require yajra/laravel-auditable:^13
```

Publish config file
-------------------

[](#publish-config-file)

If you want to modify the `withDefault` option on auditable columns, you may publish the config file.

```
php artisan vendor:publish --tag=auditable
```

Usage
-----

[](#usage)

Update your model's migration and add `created_by` and `updated_by` field using the `auditable()` blueprint macro.

```
Schema::create('users', function (Blueprint $table) {
    $table->increments('id');
    $table->string('name', 100);
    $table->auditable();
    $table->timestamps();
});
```

Then use `AuditableTrait` on your model.

```
namespace App;

use Yajra\Auditable\AuditableTrait;

class User extends Model
{
    use AuditableTrait;
}
```

Soft Deletes
------------

[](#soft-deletes)

If you wish to use Laravel's soft deletes, use the `auditableWithDeletes()` method on your migration instead:

```
Schema::create('users', function (Blueprint $table) {
    $table->increments('id');
    $table->string('name', 100);
    $table->auditableWithDeletes();
    $table->timestamps();
    $table->softDeletes()
});
```

Afterwards, you need to use `AuditableWithDeletesTrait` on your model.

```
namespace App;

use Yajra\Auditable\AuditableWithDeletesTrait;

class User extends Model
{
    use AuditableWithDeletesTrait, SoftDeletes;
}
```

Dropping columns
----------------

[](#dropping-columns)

You can drop auditable columns using `dropAuditable()` method, or `dropAuditableWithDeletes()` if using soft deletes.

```
Schema::create('users', function (Blueprint $table) {
    $table->dropAuditable();
});
```

And you're done! The package will now automatically add a basic audit log for your model to track who inserted and last updated your records.

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Arjay Angeles](https://github.com/yajra)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

67

—

FairBetter than 99% of packages

Maintenance79

Regular maintenance activity

Popularity52

Moderate usage in the ecosystem

Community29

Small or concentrated contributor base

Maturity90

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 77.2% 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

Every ~108 days

Recently: every ~95 days

Total

34

Last Release

109d ago

Major Versions

2.0.x-dev → v3.0.02019-08-27

3.0.x-dev → v4.0.02019-09-19

v4.6.0 → v11.0.02024-03-17

11.x-dev → v12.0.02025-02-28

12.x-dev → v13.0.02026-03-18

PHP version history (6 changes)v0.1.0PHP &gt;=5.5.9

v2.0.0PHP &gt;=7.0

v3.0.0PHP &gt;=7.1

v4.5.0PHP &gt;=7.2

v11.0.0PHP ^8.2

v13.0.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/8c245d1effe6022f9f09b2e8b9cce26743de03a64d612cea4ce9885560d7c0b2?d=identicon)[yajra](/maintainers/yajra)

---

Top Contributors

[![yajra](https://avatars.githubusercontent.com/u/2687997?v=4)](https://github.com/yajra "yajra (112 commits)")[![rigibore-charlie](https://avatars.githubusercontent.com/u/63846513?v=4)](https://github.com/rigibore-charlie "rigibore-charlie (8 commits)")[![gpibarra](https://avatars.githubusercontent.com/u/21188012?v=4)](https://github.com/gpibarra "gpibarra (6 commits)")[![schonhoff](https://avatars.githubusercontent.com/u/42345405?v=4)](https://github.com/schonhoff "schonhoff (4 commits)")[![GoatFreezy](https://avatars.githubusercontent.com/u/25383505?v=4)](https://github.com/GoatFreezy "GoatFreezy (3 commits)")[![jidago](https://avatars.githubusercontent.com/u/56063120?v=4)](https://github.com/jidago "jidago (2 commits)")[![emmanuelarturo](https://avatars.githubusercontent.com/u/61183606?v=4)](https://github.com/emmanuelarturo "emmanuelarturo (1 commits)")[![ivanfernz](https://avatars.githubusercontent.com/u/33168779?v=4)](https://github.com/ivanfernz "ivanfernz (1 commits)")[![22Nick22](https://avatars.githubusercontent.com/u/13195384?v=4)](https://github.com/22Nick22 "22Nick22 (1 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (1 commits)")[![nikoolz](https://avatars.githubusercontent.com/u/167667339?v=4)](https://github.com/nikoolz "nikoolz (1 commits)")[![redredimano](https://avatars.githubusercontent.com/u/135292528?v=4)](https://github.com/redredimano "redredimano (1 commits)")[![ejgandelaberon](https://avatars.githubusercontent.com/u/23096901?v=4)](https://github.com/ejgandelaberon "ejgandelaberon (1 commits)")[![DarrelEnano](https://avatars.githubusercontent.com/u/83271674?v=4)](https://github.com/DarrelEnano "DarrelEnano (1 commits)")[![shairayo](https://avatars.githubusercontent.com/u/115797032?v=4)](https://github.com/shairayo "shairayo (1 commits)")[![brandpublico](https://avatars.githubusercontent.com/u/73121702?v=4)](https://github.com/brandpublico "brandpublico (1 commits)")

---

Tags

audit-logeloquenthacktoberfestlaravelphplaravelyajraAuditable

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/yajra-laravel-auditable/health.svg)

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

###  Alternatives

[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8793.2M25](/packages/yajra-laravel-oci8)[spatie/laravel-medialibrary

Associate files with Eloquent models

6.1k43.2M633](/packages/spatie-laravel-medialibrary)[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k8.4M96](/packages/mongodb-laravel-mongodb)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[kirschbaum-development/eloquent-power-joins

The Laravel magic applied to joins.

1.6k32.6M46](/packages/kirschbaum-development-eloquent-power-joins)[glushkovds/phpclickhouse-laravel

Adapter of the most popular library https://github.com/smi2/phpClickHouse to Laravel

2051.5M2](/packages/glushkovds-phpclickhouse-laravel)

PHPackages © 2026

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