PHPackages                             hexadog/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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. hexadog/laravel-auditable

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

hexadog/laravel-auditable
=========================

Know who manipulates your models in your Laravel application.

v1.0.9(3y ago)0289MITPHP

Since May 12Pushed 2y agoCompare

[ Source](https://github.com/hexadog/laravel-auditable)[ Packagist](https://packagist.org/packages/hexadog/laravel-auditable)[ RSS](/packages/hexadog-laravel-auditable/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (2)Versions (12)Used By (0)

[![Package Logo](https://camo.githubusercontent.com/09e6e526c5bedf7c409bcfc034744fcf4f5a521cde71338d8c33ed2fce7ef5bd/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f417564697461626c652e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d68657861646f672532466c61726176656c2d617564697461626c65267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d4b6e6f772b77686f2b6d616e6970756c617465732b796f75722b6d6f64656c732b696e2b796f75722b4c61726176656c2b6170706c69636174696f6e266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d6964656e74696669636174696f6e)](https://camo.githubusercontent.com/09e6e526c5bedf7c409bcfc034744fcf4f5a521cde71338d8c33ed2fce7ef5bd/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f417564697461626c652e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d68657861646f672532466c61726176656c2d617564697461626c65267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d4b6e6f772b77686f2b6d616e6970756c617465732b796f75722b6d6f64656c732b696e2b796f75722b4c61726176656c2b6170706c69636174696f6e266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d6964656e74696669636174696f6e)

 [ ![Latest Stable Version](https://camo.githubusercontent.com/f5a0b8d218988a586fd18699c153a039d30e6c08ed8911a976b50dca918e65f8/68747470733a2f2f706f7365722e707567782e6f72672f68657861646f672f6c61726176656c2d617564697461626c652f76) ](https://packagist.org/packages/hexadog/laravel-auditable) [ ![Total Downloads](https://camo.githubusercontent.com/8b9d38be57edb90aecb9feda9830cfeaa1f6d1a1d369ddc282d4188f7357e7e1/68747470733a2f2f706f7365722e707567782e6f72672f68657861646f672f6c61726176656c2d617564697461626c652f646f776e6c6f616473) ](https://packagist.org/packages/hexadog/laravel-auditable) [ ![License](https://camo.githubusercontent.com/b90627c27e5fa52f6ac3ae4d301f7da477c3d1425ff1cd83ec6217f720d73afb/68747470733a2f2f706f7365722e707567782e6f72672f68657861646f672f6c61726176656c2d617564697461626c652f6c6963656e7365) ](https://packagist.org/packages/hexadog/laravel-auditable)

`hexadog/laravel-auditable` helps you to automatically register the user making action on your models.

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

[](#installation)

This package requires PHP 7.3 and Laravel 7.0 or higher.

To get started, install Auditable using Composer:

```
composer require hexadog/laravel-auditable
```

The package will automatically register its service provider.

Usage
-----

[](#usage)

Use the new `auditable` macro into your migrations.

```
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

Schema::table('posts', function (Blueprint $table) {
    $table->auditable();
});

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

It will add the following columns:

- created\_at
- created\_by
- updated\_at
- updated\_by
- deleted\_at
- deleted\_by

**Notice:** You don't have to use `timestamps()` nor `sofDeletes()` macros. Auditable macro will integrate them for you.

*If you altered you DB and want to drop auditable columns you can use the macro `$table->dropAuditable()`;*

Once database has been migrated you can use the `Auditable` trait into your model.

```
use Hexadog\Auditable\Models\Traits\Auditable;

class Post extends Models
{
    use Auditable;

    // ...
}
```

This way the id of the user responsible of the action (creation, update, soft deletion) is automatically registered into your model in the associated column each time the data is touched. You don't have to do anything.

Retreive user responsible of the action
---------------------------------------

[](#retreive-user-responsible-of-the-action)

You can retreive the user respoinsible of the last action (create, update, delete) by calling one of the helper methods provided by the trait.

To determine the user responsible of the model creation you may use the `created_by` attribute to get the id or the `createdBy` relation to get the target model:

```
// Get user responsible of the creation of the post
$post->createdBy;

// Get the creation date
$post->created_at;
```

To determine the user responsible of the last model update you may use the `updated_by` attribute to get the id or the `updatedBy` relation to get the target model:

```
// Get user responsible of the last update of the post
$post->updatedBy;

// Get the last update date
$post->updated_at;
```

To determine the user responsible of the model deletion (only if the model uses `SoftDeletes` trait) you may use the `deleted_by` attribute to get the id or the `deletedBy` relation to get the target model:

```
// Get user responsible of the post deletion (ONLY if soft deletes are used)
$post->deletedBy;

// Get the soft deletion date
$post->deleted_at;
```

Credits
-------

[](#credits)

- Logo made by [BeyondCode](https://banners.beyondco.de/)

License
-------

[](#license)

Laravel Auditable is open-sourced software licensed under the [MIT license](LICENSE).

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 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

Every ~77 days

Recently: every ~102 days

Total

10

Last Release

1137d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e4f38f84676dc6fd2f01e87872efe7f4849d8c4d0d8fb50195bc47903f426d7d?d=identicon)[hexadog](/maintainers/hexadog)

---

Top Contributors

[![gaetan-hexadog](https://avatars.githubusercontent.com/u/72258504?v=4)](https://github.com/gaetan-hexadog "gaetan-hexadog (30 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)[beatswitch/lock

A flexible, driver based Acl package for PHP 5.4+

870304.7k2](/packages/beatswitch-lock)[amocrm/amocrm-api-library

amoCRM API Client

182728.5k6](/packages/amocrm-amocrm-api-library)[vonage/jwt

A standalone package for creating JWTs for Vonage APIs

424.1M4](/packages/vonage-jwt)

PHPackages © 2026

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