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

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

paxha/laravel-loggable
======================

A simple loggable package for laravel

v2.0.0(4y ago)020MITPHPPHP ^7.3|^8.0

Since Jun 22Pushed 4y ago1 watchersCompare

[ Source](https://github.com/paxha/laravel-loggable)[ Packagist](https://packagist.org/packages/paxha/laravel-loggable)[ RSS](/packages/paxha-laravel-loggable/feed)WikiDiscussions main Synced yesterday

READMEChangelog (5)Dependencies (2)Versions (9)Used By (0)

[![Build Status](https://camo.githubusercontent.com/a2baf154e62b6df1f3e584c38db09c71220d0531ab9790d4606ebe4f4a8f218c/68747470733a2f2f7472617669732d63692e636f6d2f70617868612f6c61726176656c2d6c6f676761626c652e7376673f6272616e63683d6d61696e)](https://travis-ci.com/paxha/laravel-loggable.svg?branch=main)[![StyleCI](https://camo.githubusercontent.com/c035a0480e69e83597901368ddc50d318c305aa90a41c78ececb9405eb914b21/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3337393138343939332f736869656c643f6272616e63683d6d61696e)](https://github.styleci.io/repos/379184993?branch=main)[![Total Downloads](https://camo.githubusercontent.com/8d1b9ae642c8f6ef1b9fd6030c42d954c7ce7bba22fc2e8be9d934a1267f3324/68747470733a2f2f706f7365722e707567782e6f72672f70617868612f6c61726176656c2d6c6f676761626c652f642f746f74616c2e7376673f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/paxha/laravel-loggable)[![Latest Stable Version](https://camo.githubusercontent.com/b6d432774e731954996a20c77e0b3a623e0b388d5f46dfdecfa48ade8ffe4f9c/68747470733a2f2f706f7365722e707567782e6f72672f70617868612f6c61726176656c2d6c6f676761626c652f762f737461626c652e7376673f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/paxha/laravel-loggable)[![License](https://camo.githubusercontent.com/4103ffa37cf40562ca28a761f8457ef79efe91415ec89277e4cd5cd556157dfa/68747470733a2f2f706f7365722e707567782e6f72672f70617868612f6c61726176656c2d6c6f676761626c652f6c6963656e73652e7376673f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/paxha/laravel-loggable)

The `paxha/laravel-loggable` package provides easy to use functions to log the all CRUD operations of the loggable model in your app. It can also automatically log model events. All Logs will be stored in the `logs` table.

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

[](#installation)

Add the package to your Laravel app using composer

```
composer require paxha/laravel-loggable

```

### Getting Started

[](#getting-started)

Execute the Artisan command to run the migrations.

```
php artisan migrate

```

Usage
-----

[](#usage)

To start logging CRUD operations simply use the trait on your models.

```
use Loggable\Traits\Loggable;

class Product extends Model
{
    use Loggable;

    ...

```

### Model's Logs

[](#models-logs)

Logs that are stored in database are something like this string

"A New **Product 1** is Created by - User Name"

to override this bold **name** string you can write this method in your Model.

by default it will take **name** column

```
use Loggable\Traits\Loggable;

class Product extends Model
{
    use HasLogs;

    public function getActedUpon(){
        return $this->title;
    }
}

```

it can be any column from your Loggable table like name,title,product\_name or anything.

You can retrieve Loggable Model's Logs

```
$product_logs = Product::first()->logs();
// return Array of first Product's logs

```

You can retrieve Authenticatable Model's Logs by using this Trait **HasLogs**

```
use Loggable\Traits\Loggable;

class User extends Model
{
    use HasLogs;

    ...

```

```
$user_logs = auth()->user()->logs();
// return Array of current authenticated User's logs

```

Logs that are stored in database are something like this string

### User's Logs

[](#users-logs)

"A New Product 1 is Created by - **User Name**"

to override this bold user's **name** string you can write this method in your Model.

```
use Loggable\Traits\Loggable;

class User extends Model
{
    use HasLogs;

    public function getActor(){
        return $this->first_name." ".$this->last_name;
    }
}

```

by default it will take **name** column

it can be any column from your Autheticatable table like name,email,id or anything

#### Using Both Traits in one Place

[](#using-both-traits-in-one-place)

if you want to use both Traits in One Model you will need to implement this code snippet to overcome multiple inheritence problem

```
 use Loggable\Traits\Loggable;

 class User extends Model
 {
     use Loggable, HasLogs {
             Loggable::logs insteadof HasLogs;
             HasLogs::logs as historyLogs;
         }
 }

```

you can choose any name instead of **historyLogs**

```
$user_logs = auth()->user()->historyLogs();
// return Array of current authenticated User's logs

```

---

License
-------

[](#license)

This is open-sourced laravel library licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~4 days

Total

2

Last Release

1781d ago

Major Versions

v1.0.0 → v2.0.02021-06-26

### Community

Maintainers

![](https://www.gravatar.com/avatar/2816953f287ca302f12d59f94de4e90cd6cb5d2ba1f6eaa462045c2670969ea0?d=identicon)[paxha](/maintainers/paxha)

---

Top Contributors

[![shehrozafzal](https://avatars.githubusercontent.com/u/81261087?v=4)](https://github.com/shehrozafzal "shehrozafzal (11 commits)")[![paxha](https://avatars.githubusercontent.com/u/38579192?v=4)](https://github.com/paxha "paxha (10 commits)")[![shehroz-myglu](https://avatars.githubusercontent.com/u/76989359?v=4)](https://github.com/shehroz-myglu "shehroz-myglu (10 commits)")[![abidaslam](https://avatars.githubusercontent.com/u/47294944?v=4)](https://github.com/abidaslam "abidaslam (3 commits)")[![abid-aslam-my-glu](https://avatars.githubusercontent.com/u/70682536?v=4)](https://github.com/abid-aslam-my-glu "abid-aslam-my-glu (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B9.2k](/packages/psr-log)[itsgoingd/clockwork

php dev tools in your browser

5.9k27.6M94](/packages/itsgoingd-clockwork)[graylog2/gelf-php

A php implementation to send log-messages to a GELF compatible backend like Graylog2.

41838.2M138](/packages/graylog2-gelf-php)[bugsnag/bugsnag-psr-logger

Official Bugsnag PHP PSR Logger.

32132.5M2](/packages/bugsnag-bugsnag-psr-logger)[consolidation/log

Improved Psr-3 / Psr\\Log logger based on Symfony Console components.

15462.2M7](/packages/consolidation-log)[datadog/php-datadogstatsd

An extremely simple PHP datadogstatsd client

19124.6M15](/packages/datadog-php-datadogstatsd)

PHPackages © 2026

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