PHPackages                             lukasjankowski/laravel-revision - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. lukasjankowski/laravel-revision

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

lukasjankowski/laravel-revision
===============================

A laravel 5 revision package for watching changes with multi guard support

1.0.0(8y ago)27961[1 PRs](https://github.com/LukasJankowski/laravel-revision/pulls)MITPHP

Since Aug 15Pushed 5y agoCompare

[ Source](https://github.com/LukasJankowski/laravel-revision)[ Packagist](https://packagist.org/packages/lukasjankowski/laravel-revision)[ RSS](/packages/lukasjankowski-laravel-revision/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (2)Used By (0)

Unmaintained
============

[](#unmaintained)

Laravel-Revision for Larvel 5
=============================

[](#laravel-revision-for-larvel-5)

This package allows you to log changes made to specific models.

> Note: There are many packages, which cover similar aspects. This package was heavily inspired by [Revisionable](https://github.com/VentureCraft/revisionable/)and [Laravel-Auditing](http://www.laravel-auditing.com/)you should definitely check them out.

Why another?
------------

[](#why-another)

Simple: Both these packages do not - at the time of writing - multi-auth support. **This one does.**

I ran into a problem while working on a project, namely that I wanted to use said packages and got stuck as soon as I realized that they do not support different Auth-Providers. So I went ahead and made this package. It follows the same basic principle and uses a very similar syntax.

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

[](#installation)

Require via composer:

```
composer require lukasjankowski/laravel-revision

```

Include the service provider within your `config/app.php`.

```
'providers' => [
    // ...
    LukasJankowski\Revision\RevisionServiceProvider::class
];
```

Publish the config file.

```
php artisan vendor:publish --provider="LukasJankowski\Revision\RevisionServiceProvider" --tag="config"

```

Publish the migration.

```
php artisan vendor:publish --provider="LukasJankowski\Revision\RevisionServiceProvider" --tag="migrations"

```

You can change the table name within the config file, which will be located at: `config/revision.php`.

Finally migrate the migration:

```
php artisan migrate

```

Usage
-----

[](#usage)

Add the `LukasJankowski\Revision\Traits\HasRevisions` trait to the models, which you want to enable revisions on.

Example:

```
use Illuminate\Database\Eloquent\Model;
use LukasJankowski\Revision\Traits\HasRevision;

class Post extends Model
{
    use HasRevisions;

    // ...
}
```

Add the `LukasJankowski\Revision\Traits\IsReviser` trait to the models, which you want to be the ones perfoming the revisions.

Example:

```
use Illuminate\Foundation\Auth\User as Authenticatable;
use LukasJankowski\Revision\Traits\IsReviser;

class User extends Authenticatable
{
    use IsReviser;

    // ...
}
```

You can perform the configuration in the generalized `config/revision.php` file. But if you want to perform more fine grained control:

```
use Illuminate\Database\Eloquent\Model;
use LukasJankowski\Revision\Traits\HasRevision;

class Post extends Model
{
    use HasRevisions;

    /**
     * The fields, which will not be logged in the revisions.
     *
     * @var array
     */
    protected $revisionExclude = [
        'password', 'remember_token',
    ];

    /**
     * The threshold, which will limit the revisions to that number.
     *
     * @var int
     */
    protected $revisionThreshold = 123;

    // ...
}
```

Revisions will log the `created`, `updated`, `deleted` and `restored` event.

You can then access these revisions:

From the model, which "hasRevisions":

```
    $post = App\Post::find(1);
    $post->revisions; // Returns all revisions made to this record in a collection.
```

From the model, which "hasRevisions" with eager-loading:

```
    $post = App\Post::find(1);
    $post->revisions()->with('revisers')->get(); // Same as above, but eager load the ones, who performed the revision.
```

From the model, which "isReviser", which performed the revision:

```
    $user = App\User::find(1);
    $user->revised; // Returns all revisions made by this record in a collection.
```

From the model, which "isReviser", which performed the revision with eager-loading:

```
    $user = App\User::find(1);
    $user->revised()->with('revisions')->get();
    // Same as above, but eager load the models on which the revisions were performed.
```

Since it's a collection it supports all its methods:

```
    $post = App\Post::find(1);
    $post->revisions->first();
    $post->revisions->last();
    $post->revisions->find(12);
    // ...
```

But also a way to get the modified data:

```
    $post = App\Post::find(1);
    $revision = $post->revisions->first();
    $revision->getModified();
    // Which will return an associative array similar to this:
    [
        'title' => [
            'new' => 'Fresh and new',
            'old' => 'Old and stale',
        ],
        'body' => [
            'new' => 'Lorem ipsum...',
            'old' => 'Placeholder.Place...',
        ],
    ];
```

As you can see it is very similar to the above mentioned packages. However it doesn't matter, who performs the revision as long as they implement the IsReviser trait. The package will then go ahead and try to fetch the currently logged in user as the reviser, if that fails it will default to null.

TODO
----

[](#todo)

- Unit tests

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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

3192d ago

### Community

Maintainers

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

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/lukasjankowski-laravel-revision/health.svg)

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

PHPackages © 2026

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