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 2w 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 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

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

2661d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/43416927?v=4)[good-system](/maintainers/good-system)[@good-system](https://github.com/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

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k116.5M113](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[pgvector/pgvector

pgvector support for PHP

198628.3k10](/packages/pgvector-pgvector)

PHPackages © 2026

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