PHPackages                             mouadziani/laravel-model-trackable - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. mouadziani/laravel-model-trackable

AbandonedArchivedLibrary[Logging &amp; Monitoring](/categories/logging)

mouadziani/laravel-model-trackable
==================================

A laravel package that allows you to tracker and log nested changes applied on your models and their relations using a single Trait

1.0(5y ago)5882[2 issues](https://github.com/MouadZIANI/laravel-model-trackable/issues)MITPHP

Since Nov 26Pushed 3y ago2 watchersCompare

[ Source](https://github.com/MouadZIANI/laravel-model-trackable)[ Packagist](https://packagist.org/packages/mouadziani/laravel-model-trackable)[ Docs](https://github.com/mouadziani/laravel-model-trackable)[ RSS](/packages/mouadziani-laravel-model-trackable/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (5)Versions (3)Used By (0)

 [![logo](art/logo.jpeg)](art/logo.jpeg)

[![Latest Version on Packagist](https://camo.githubusercontent.com/dcc94c2e4b0d9c458021ece16ed406d0e52bd4858308ce29e0d5f3575e8323d7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6f7561647a69616e692f6c61726176656c2d6d6f64656c2d747261636b61626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mouadziani/laravel-model-trackable)

A laravel package that allows you to track and log nested changes applied on your (models, and their relations) using a **single Trait**

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

[](#installation)

You can install the package via composer:

```
composer require mouadziani/laravel-model-trackable
```

Simple Usage
------------

[](#simple-usage)

- Firstly you have to apply trackable trait on your model

```
use LaravelModelTrackable\Traits\Trackable;

class ModelName extends Model
{
    use Trackable;

    //
}
```

- In case you want to track the changes applied on your model's relationships, you need to add an attribute in your model called `$toBeLoggedRelations` which must contain an array of relationships like the example below

```
use LaravelModelTrackable\Traits\Trackable;

class ModelName extends Model
{
    use Trackable;

    public $toBeLoggedRelations = ['relation1', 'relation2'];
}
```

- Then, you can get an array that should contains all changes applied on your model after every update

```
$model = ModelName::update([
    ...
]);

// Get list of changed attributes
$model->getChangedAttributes();
```

Disclaimer
----------

[](#disclaimer)

Currently this package can't track hasMany, ManyToMany or MorphMany relations

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

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

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

[](#contributing)

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

### Security

[](#security)

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

Credits
-------

[](#credits)

- [Mouad ZIANI](https://github.com/mouadziani)
- [All Contributors](../../contributors)

Licence
-------

[](#licence)

This package is [Treeware](https://treeware.earth). If you use it in production, then we ask that you [**buy the world a tree**](https://plant.treeware.earth/mouadziani/laravel-model-trackable) to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.

featured\_repository

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

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

2046d ago

### Community

Maintainers

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

---

Top Contributors

[![mouadziani](https://avatars.githubusercontent.com/u/29683939?v=4)](https://github.com/mouadziani "mouadziani (46 commits)")[![akiyamaSM](https://avatars.githubusercontent.com/u/12276076?v=4)](https://github.com/akiyamaSM "akiyamaSM (1 commits)")

---

Tags

laravellaravel-packagephpmouadzianilaravel-model-trackable

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mouadziani-laravel-model-trackable/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45444.2k1](/packages/pressbooks-pressbooks)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)[masterro/laravel-mail-viewer

Easily view in browser outgoing emails.

65108.9k](/packages/masterro-laravel-mail-viewer)[rapidez/core

Rapidez Core

1823.5k72](/packages/rapidez-core)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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