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. mouadziani/laravel-model-trackable

ActiveLibrary

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 1mo ago

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 54% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity54

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

1994d 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

[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k7.2M71](/packages/mongodb-laravel-mongodb)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[watson/validating

Eloquent model validating trait.

9723.3M47](/packages/watson-validating)[cybercog/laravel-ban

Laravel Ban simplify blocking and banning Eloquent models.

1.1k651.8k11](/packages/cybercog-laravel-ban)[dyrynda/laravel-model-uuid

This package allows you to easily work with UUIDs in your Laravel models.

4802.8M8](/packages/dyrynda-laravel-model-uuid)[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)

PHPackages © 2026

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