PHPackages                             good-system/laravel-model-history - 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. good-system/laravel-model-history

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

good-system/laravel-model-history
=================================

0.0.2(7y ago)055PHP

Since Feb 7Pushed 7y agoCompare

[ Source](https://github.com/good-system/laravel-model-history)[ Packagist](https://packagist.org/packages/good-system/laravel-model-history)[ RSS](/packages/good-system-laravel-model-history/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (3)Used By (0)

Laravel Model History
=====================

[](#laravel-model-history)

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

[](#installation)

```
composer require good-system/laravel-model-history
composer migrate

```

Usage
-----

[](#usage)

### Use Generic `ModelObserver`

[](#use-generic-modelobserver)

If model history logging/recording for "created" and "updated" are the only things you need to do in a model observer, simply add something like the following to your service provider class:

```
class AppServiceProvider extends ServiceProvider
{
    public function boot()
    {
        Donation::observe(\GoodSystem\ModelHistory\ModelObserver::class);
    }
}

```

And two model actions will be logged in database table `model_history`

- new donation created
- donation updated

### Use Trait `ModelChangeEventTraits`

[](#use-trait-modelchangeeventtraits)

If your model observer needs to observe additional model events, but for "created" and "updated" events, model history logging/recording is the only thing needed, trait `ModelChangeEventTraits` could be added to observer class, like this

```
class YOUR_MODEL_Observer
{
    use \GoodSystem\ModelHistory\ModelChangeEventTraits;

    // other model events such as deleted, saved, etc.
}

```

### Use `ModelFieldHistory` model static methods directly

[](#use-modelfieldhistory-model-static-methods-directly)

Model class `ModelFieldHistory` provides two additional methods

- `forModelCreated()` - record newly created model
- `forFieldChanges()` - record changes made to the model

If your model observer's "created" or "updated" event needs to do history logging/recording, plus other things, these two methods can be called from the observer directly, like this:

```
class YOUR_MODEL_Observer
{
    public function updated(YOUR_MODEL $modelObject)
    {
        ModelHistory::forFieldChanges(auth()->user(), $modelObject)->save();
        // Other things that need to be done upon model record update
    }

    public function created(YOUR_MODEL $modelObject)
    {
        ModelHistory::forModelCreated(auth()->user(), $modelObject)->save();
        // Other things that need to be done upon model record creation
    }
}

```

### Other Usage

[](#other-usage)

No other usage at this point. Note that the database table is not limited to accommodate these two changes.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

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 ~38 days

Total

2

Last Release

2614d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/818b3b273afad37f8e31087d6e399403493e153934beeb9e78480ce42ee9719e?d=identicon)[good-system](/maintainers/good-system)

---

Top Contributors

[![singingfox](https://avatars.githubusercontent.com/u/34545721?v=4)](https://github.com/singingfox "singingfox (2 commits)")

### Embed Badge

![Health badge](/badges/good-system-laravel-model-history/health.svg)

```
[![Health](https://phpackages.com/badges/good-system-laravel-model-history/health.svg)](https://phpackages.com/packages/good-system-laravel-model-history)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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