PHPackages                             devlab-studio/laravel-logs - 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. devlab-studio/laravel-logs

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

devlab-studio/laravel-logs
==========================

Package to manage logs in Laravel applications.

1.0.10(1mo ago)12151MITPHPPHP ^8.3CI failing

Since Mar 17Pushed 1mo agoCompare

[ Source](https://github.com/devlab-studio/laravel-logs)[ Packagist](https://packagist.org/packages/devlab-studio/laravel-logs)[ Docs](https://github.com/devlab-studio/laravel-logs)[ GitHub Sponsors](https://github.com/Devlab)[ RSS](/packages/devlab-studio-laravel-logs/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (10)Dependencies (24)Versions (12)Used By (1)

 [ ![Devlab Logo](https://camo.githubusercontent.com/6313273fb35f1ad9a9fd1b33bcc7a5803c7147f6e5b6a7e9797c4cc4b130b04b/68747470733a2f2f6465762d6c61622e65732f6173736574732f6c6f676f732f6d61696e2d6c696768742e737667) ](https://dev-lab.es)

 [![Español](https://camo.githubusercontent.com/493bbce836760fc1c7c7e031d4efff413652f76ac1b9e88b6ba8914e14b81cb8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f457370612543332542316f6c2d566572253230656e25323045532d626c75652e7376673f7374796c653d666c61742d737175617265)](README.es.md)

**Laravel Logs** is a Laravel package for advanced logs and audits management, allowing you to register, query, and clean logs efficiently in your Laravel projects.

- Register and query custom logs
- Audit models and procedures
- Commands to clean and manage logs
- Flexible and extensible configuration

What It Does
------------

[](#what-it-does)

This package adds a lightweight audit layer for Eloquent models by logging save and delete operations.

- Tracks procedure names such as `App\\Models\\Order::save` and `App\\Models\\Order::delete`
- Stores change payloads in JSON format
- Records the user responsible for the action
- Keeps a normalized table of procedures for easier filtering/reporting

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

[](#installation)

Install the package via Composer:

```
composer require devlab-studio/laravel-logs
```

Publish and run the migrations:

```
php artisan vendor:publish --tag=laravel-logs-migrations
php artisan migrate
```

Publish the configuration file:

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

Useful Commands
---------------

[](#useful-commands)

Clean old logs:

```
php artisan logs:clear
```

`logs:clear` removes records older than 12 months.

How It Works
------------

[](#how-it-works)

1. Your model extends the package base model (`Devlab\\LaravelLogs\\Models\\Model`).
2. On `save()`, the package detects dirty attributes and logs original vs changed data.
3. On `delete()`, the package logs the deleted model ID.
4. The procedure name is registered in `models_procedures` if it does not exist yet.
5. The action is stored in `models_logs` with timestamps and `created_user`.

Database Structure
------------------

[](#database-structure)

### `models_procedures`

[](#models_procedures)

- `id`
- `procedure` (example: `App\\Models\\Invoice::save`)
- `created_at`, `updated_at`

### `models_logs`

[](#models_logs)

- `id`
- `procedure`
- `procedure_id` (FK to `models_procedures.id`)
- `data` (JSON / text)
- `created_user`
- `created_at`, `updated_at`

Usage Example
-------------

[](#usage-example)

Extend your models from the package base model:

```
