Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/HypathStack/model-scribe/llms.txt

Use this file to discover all available pages before exploring further.

ModelScribe is a driver-based audit log package for Laravel that records every Eloquent model change and routes those records exactly where you need them. Whether your application demands a queryable database table, plain log files, or a fan-out to multiple targets at the same time, ModelScribe handles the routing through a clean, swappable driver architecture — with no lock-in and no boilerplate beyond a single trait on your model.

Key Features

Trait-Based Eloquent Integration

Add HasAuditLog to any Eloquent model and every created, updated, and deleted event is captured automatically — no event listeners to register by hand.

Multi-Target Drivers

Ship logs to a database table, a file channel, or a stack driver that fans a single entry out to multiple targets simultaneously. Swap drivers at the application or per-model level.

Multi-Table Routing

Use named stores within the database driver to route different business domains to different tables or even different database connections — keep order_logs and invoice_logs cleanly separated.

Deep Attribute Diffing

Every log entry stores the full old and new attribute snapshot inside a properties JSON column, so you always know exactly what changed and what the previous value was.

Configurable Retention Policies

Choose between permanent storage, time-based pruning (days), or a rotating window that keeps only the latest N records per subject — then run model-scribe:prune on a schedule to enforce it.

Rich Request Context

ModelScribe automatically captures the request URL, IP address, and User Agent for every log entry created during an HTTP request, giving you complete traceability for every change.

Manual Logging via Facade

Use the ModelScribe facade to log arbitrary events that aren’t tied to an Eloquent lifecycle — ideal for bulk operations, imports, or any business action you want on the audit trail.

Custom Driver Support

Extend the driver manager with your own implementation via extend() to ship logs to Elasticsearch, webhooks, or any other target your infrastructure requires.

Laravel & PHP Compatibility

ModelScribe requires PHP 8.3 or higher and supports Laravel 11 and Laravel 12. The package depends on illuminate/contracts ^11.0||^12.0, ensuring compatibility with both framework generations.
RequirementVersion
PHP^8.3
Laravel11 or 12
ModelScribe is released under the MIT License, meaning it is free to use in personal, open-source, and commercial projects. See the LICENSE.md file in the repository for the full licence text.

Next Steps

Ready to add ModelScribe to your application? Follow the installation guide to get the package, its config file, and its migration in place.

Install ModelScribe

Require the package with Composer, publish the config and migration, and run php artisan migrate in under two minutes.

Build docs developers (and LLMs) love