PHPackages                             themightysapien/loggable - 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. themightysapien/loggable

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

themightysapien/loggable
========================

:This packages allows the laravel models to have automatic logging

1221PHP

Since Feb 26Pushed 10y ago1 watchersCompare

[ Source](https://github.com/themightysapien/loggable)[ Packagist](https://packagist.org/packages/themightysapien/loggable)[ RSS](/packages/themightysapien-loggable/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

loggable
========

[](#loggable)

Loggable is a Laravel 5 package which helps users to keep simple log of their model CRUD operations. .

Install
-------

[](#install)

Via Composer

```
$ composer require themightysapien/loggable
```

Add the service provider to the providers array in app.php

```
Themighty\Loggable\LoggableServiceProvider

//THen do vendor:publish from the artisan command to copy the migration file migrate it
php artisan vendor:publish
php artisan migrate
```

Usage
-----

[](#usage)

```
//use LoggableModelTrait in any of your models whose CRUD logs you want to keep
class DemoModel extends \Eloquent {
    use Themighty\Loggable\Traits\LoggableModelTrait
}
```

Then you need to define a **getLogData()** function as

```
public function getLogData()
    {
        return array(
            'routeName' => 'admin.inventories',
            'title' => 'name',
            'modelName' => 'Inventory Item',
            'user' => \Auth::id()
        );
    }
```

**routeName** : leave it empty if you dont want the log data to be a link, or you can keep name of the resource route.

**title** : this is the DB table column whose data will be shown in the log.

**modelname** : Readable model name for the log.

**user** : the id of the user who performed the actions in the model.

THen you can display the logs as follows

```
//for all logs loop through \Themightysapien\Loggable\Logs::all() or filter it however you like

//for model specific logs you can call $model->logs to get model specific logs

//then inside the loop you can access the user with ->user property

foreach($model->logs as $log){
    echo $log->getModelName().' || '.$log->getLogEntry().' ||'.$log->getAction();
    echo '';
    echo 'By :'.$log->user->name.' at '.$log->created_at;
}
```

The above code will produce the result like

**Inventory Item** || **Milk** || **added**

By **themightysapien** at 2015-12-12 00:00:00

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)

- [themightysapien](https://github.com/themightysapien)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/0b23d648de438858204fbfe985741871400a0084396a5f44a3e97522f7e7b110?d=identicon)[themightysapien](/maintainers/themightysapien)

---

Top Contributors

[![themightysapien](https://avatars.githubusercontent.com/u/732813?v=4)](https://github.com/themightysapien "themightysapien (11 commits)")

### Embed Badge

![Health badge](/badges/themightysapien-loggable/health.svg)

```
[![Health](https://phpackages.com/badges/themightysapien-loggable/health.svg)](https://phpackages.com/packages/themightysapien-loggable)
```

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B11.5k](/packages/psr-log)[open-telemetry/api

API for OpenTelemetry PHP.

1941.5M276](/packages/open-telemetry-api)[open-telemetry/sdk

SDK for OpenTelemetry PHP.

2328.5M343](/packages/open-telemetry-sdk)

PHPackages © 2026

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