Download the PHP package umairhanifdev/laravel-table-logger without Composer
On this page you can find all versions of the php package umairhanifdev/laravel-table-logger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download umairhanifdev/laravel-table-logger
More information about umairhanifdev/laravel-table-logger
Files in umairhanifdev/laravel-table-logger
Package laravel-table-logger
Short Description Automated Laravel model auditing and application log management with dynamic table creation. Tracks all model changes (create/update/delete) in dedicated log tables while maintaining native Laravel conventions. Provides comprehensive activity monitoring without database modifications.
License MIT
Informations about the package laravel-table-logger
# Laravel Table Logger
A Laravel package to automatically or manually log model events (create, update, delete) either to the database or file system, based on .env
configuration.
🚀 Features
-
🔁 Automatically logs
create
,update
,delete
actions on models -
⚙️ Supports both database and file logging via
.env
-
🧠 Easily retrieve logs using model relationships
-
🔧 Manually log any action without relying on model events
-
📁 Structured file-based logs per table and record
- 📦 Simple to integrate via Eloquent traits
📦 Installation
⚙️ Configuration
Publish config (optional):
Set logging driver in your .env
:
-
database: Logs are stored in
{table_name}_logs
tables - file: Logs are stored in
storage/logs/umairhanifdev/{table}/{id}.log
📘 Usage
1. Eloquent Model Logging
Step 1: Add Traits
Add the following traits to your Eloquent model. Once added, logs will automatically be generated on create
, update
, and delete
actions.
2. Retrieve Stored Logs
Logs for a Single Model Record
Logs for Multiple Records
3. Manual Logging (No Eloquent Required)
You can manually log an action without triggering Eloquent events:
4. Nested Logs via Relationships
If your model (e.g., User
) has child models using logs (e.g., ExaminationReport
), you can retrieve logs as:
🗃️ Log Table Naming Convention
Log tables are automatically named using the singular form of the model table name + _logs
. Example: users
→ user_logs
You can define custom mappings for irregular plurals:
📂 File-based Log Format
When using TABLE_LOGGER_DRIVER=file
, logs are saved as JSON files in:
Each file will contain all logs of a specific record.
📝 License
MIT
Built with ❤️ by Umair Hanif