PHPackages                             laravellogger/modellogger - 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. laravellogger/modellogger

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

laravellogger/modellogger
=========================

A Laravel package that logs model events like created, updated, and deleted.

01PHP

Since Nov 12Pushed 5mo agoCompare

[ Source](https://github.com/NayanRaval00/laravel-model-logger)[ Packagist](https://packagist.org/packages/laravellogger/modellogger)[ RSS](/packages/laravellogger-modellogger/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

🚀 Laravel Model Logger
======================

[](#-laravel-model-logger)

[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)[![Laravel](https://camo.githubusercontent.com/99523389690eaafdb995a8fdfcf38089c62b3f160c30483bb7ccc6ca246312ef/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31322e782d6f72616e67652e737667)](https://laravel.com)[![PHP](https://camo.githubusercontent.com/12ba79b4c8771d8067d75af9042c66480c860df180785c6462538e847ea1a5d2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253545382e322d626c75652e737667)](https://www.php.net/)

A simple and powerful Laravel package that **automatically logs Eloquent model events** (Created, Updated, Deleted) into a database or a log file.

---

✨ Features
----------

[](#-features)

- 🔄 Automatically logs `created`, `updated`, and `deleted` events.
- 💾 Choose between **database logging** or **file logging**.
- ⚙️ Fully configurable.
- 📜 Easy to integrate using a simple trait.
- 🧩 Compatible with Laravel 10, 11, and 12.

---

🧱 Installation
--------------

[](#-installation)

### 1️⃣ Add the repository (if you’re developing locally)

[](#1️⃣-add-the-repository-if-youre-developing-locally)

In your Laravel project’s `composer.json`:

```
"repositories": [
    {
        "type": "path",
        "url": "app/packages/laravellogger/modellogger",
        "options": { "symlink": true }
    }
]
```

2️⃣ Require the package

```
composer require nayan/model-logger:@dev

```

3️⃣ Publish config (optional)

```
php artisan vendor:publish --tag=config

```

(This will create: config/model-logger.php)

4️⃣ Run migrations (if using database logging)

```
php artisan migrate

```

⚙️ Configuration

config/model-logger.php:

```
return [
    'log_to' => 'database', // or 'file'
    'log_file' => storage_path('logs/model-events.log'),
];

```

You can switch between logging to a database or to a log file easily.

🧩 Usage

Add the LogsModelEvents trait to any Eloquent model you want to monitor.

```
use laravelLogger\ModelLogger\Traits\LogsModelEvents;

class Post extends Model
{
    use LogsModelEvents;
}

```

That’s it! 🎉

Whenever this model is created, updated, or deleted, an entry will automatically be logged.

📊 Example Log Entries

🗃️ Database Example

idmodeleventattributescreated\_at1App\\Models\\Postcreated{"id":1,"title":"Hello World"}2025-11-11 10:00:002App\\Models\\Postupdated{"id":1,"title":"Updated Title"}2025-11-11 10:05:00

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance50

Moderate activity, may be stable

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 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/a797a75c0c574a6ffc38b2a04be4fc98acd1c0987200b884cab738cef2b618bd?d=identicon)[nayanraval](/maintainers/nayanraval)

---

Top Contributors

[![NayanRaval00](https://avatars.githubusercontent.com/u/50438576?v=4)](https://github.com/NayanRaval00 "NayanRaval00 (5 commits)")

### Embed Badge

![Health badge](/badges/laravellogger-modellogger/health.svg)

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

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B9.1k](/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.2M137](/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)
