PHPackages                             devel8/laravel-action-tracker - 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. devel8/laravel-action-tracker

ActiveLaravel-package[Utility &amp; Helpers](/categories/utility)

devel8/laravel-action-tracker
=============================

A simple package for tracking actions over models

1.0.0(8mo ago)542MITPHPPHP ^7.0

Since Sep 17Pushed 8mo ago2 watchersCompare

[ Source](https://github.com/Devel8/laravel-action-tracker)[ Packagist](https://packagist.org/packages/devel8/laravel-action-tracker)[ RSS](/packages/devel8-laravel-action-tracker/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (12)Used By (0)

Laravel Action Tracker
======================

[](#laravel-action-tracker)

This package provides an easy way to have an historical of actions done over models.

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

[](#installation)

Execute the following command to get the latest version of the package:

```
composer require devel8/laravel-action-tracker

```

Edit the config/app.php file and add the following line to register the service provider:

```
'providers' => [
    ...
    Devel8\LaravelActionTracker\ActionTrackerProvider::class,
],
```

Run publish command to copy package configuration:

```
php artisan vendor:publish --provider "Devel8\LaravelActionTracker\ActionTrackerProvider"

```

Finally, you will should run migration database command:

```
php artisan migrate

```

Usage
-----

[](#usage)

Use `Devel8\LaravelActionTracker\ActionTrackerTrait` as trait in your model class:

```
class Post extends Model
{
    use ActionTrackerTrait;
```

Specify the actions done in the model, defining an `actions` attribute in your model class:

```
protected $actions = [
        'closed',
        'created'
    ];
```

Register an action done over a model executing `doActionTracker` method as below:

```
$user = Auth::user();
$post = Post::find(56);
$post->doActionTracker('closed', "Post was closed by {$user->user_nick}");
```

Get the actions over a specific model:

```
// Retrieve all actions over a specific model
$post = Post::find(56);
$actions = $post->actionTracker()->get();

// Retrieve one action over a specific model:
$post = Post::find(56);
$actions = $post->actionTracker()->where('action', 'closed')->get();
```

Events
------

[](#events)

The Eloquent model method `doActionTracker` dispatch a generic event in each action tracker registration. You can listen this event adding the below code in your `App\Providers\EventServiceProvider`:

```
/**
 * The event listener mappings for the application.
 *
 * @var array
 */
protected $listen = [
    \Devel8\LaravelActionTracker\ActionTracked::class => [
        \App\Listeners\YourListener::class,
    ],
];
```

Whether you prefer listen an action, you can add your custom event for each action adding it at the property `actionEvents` in your Eloquent model as below:

```
    /**
     * Action events list
     */
    protected array $actionEvents = [
        'closed' => \App\Events\PostClosed::class
    ];
```

ActionTracker send the Eloquent model `ActionTracker` as argument to the constructor of your custom action event. Therefore the event class looks like:

```
    class PostClosed
    {

        use SerializesModels;

        public ActionTracker $actionTracker;

        /**
         * ActionTracked constructor.
         *
         * @param ActionTracker $actionTracker
         */
        public function __construct(ActionTracker $actionTracker)
        {
            $this->actionTracker = $actionTracker;
        }

    }
```

You can follow [the official laravel documentation](https://laravel.com/docs) for further information about [register events and listeners](https://laravel.com/docs/5.8/events).

Configuration
-------------

[](#configuration)

You can configure some options as model, table name and columns name prefix:

```
[

    /*
     * Disable all action tracking.
     * Therefore if disabled the actions will not be persisted in the database.
     */
    'disable' => false,

    /*
     * Action Tracker Model Class
     */
    'model' => \CustomActionTracker::class,

    /*
     * Database table where actions are tracked
     */
    'table_name' => 'custom_action_trackers',

    /*
     * Prefix word used to database columns name
     */
    'prefix' => 'custom_action_tracker',

    /*
    * Log action tracking in the log as info type.
    */
    'log_tracking' => false

]
```

Troubleshooting
---------------

[](#troubleshooting)

### Polymorphic relation

[](#polymorphic-relation)

This package uses polymorphic relationship, so you can get troubles when you want to retrieve actions information by models. By default Laravel saves model namespace in the database for relation model purpose. As namespaces have backslashes it could be a trouble when you filter by model. To avoid this you can map model class names in your `AppService Provider`:

```
class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        Relation::morphMap([
            'Post' => \Entities\Post::class
        ]);
    }
```

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance59

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 63% 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 ~316 days

Recently: every ~632 days

Total

9

Last Release

264d ago

Major Versions

v0.x-dev → 1.0.02025-08-21

PHP version history (2 changes)0.1.1PHP ^5.3.3 || ^7.0

1.0.0PHP ^7.0

### Community

Maintainers

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

---

Top Contributors

[![ifranco-dev8](https://avatars.githubusercontent.com/u/122022573?v=4)](https://github.com/ifranco-dev8 "ifranco-dev8 (17 commits)")[![ifranco88](https://avatars.githubusercontent.com/u/17825632?v=4)](https://github.com/ifranco88 "ifranco88 (10 commits)")

---

Tags

entitylaravellaravel-packagetracking

### Embed Badge

![Health badge](/badges/devel8-laravel-action-tracker/health.svg)

```
[![Health](https://phpackages.com/badges/devel8-laravel-action-tracker/health.svg)](https://phpackages.com/packages/devel8-laravel-action-tracker)
```

###  Alternatives

[wireui/wireui

TallStack components

1.8k1.3M16](/packages/wireui-wireui)[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4195.3M84](/packages/livewire-volt)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)

PHPackages © 2026

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