Skip to main content
This page walks through everything you need to get ModelScribe running in a Laravel application: pulling in the package with Composer, publishing the configuration file and database migration, and running that migration to create the model_scribe_logs table. Once these four steps are complete you can start adding the HasAuditLog trait to your models.

Install the Package

1

Require the package via Composer

Add ModelScribe to your project’s dependencies with the following command. Laravel’s package auto-discovery will register the service provider and ModelScribe facade alias automatically — no manual registration is needed.
2

Publish the configuration file

Publish the model-scribe.php configuration file to your application’s config/ directory. This file is where you define drivers, named stores, retention policies, and global settings.
After running this command, a fully commented config/model-scribe.php file will be created. You can adjust the default driver, database connection, table name, and retention settings here — or leave the defaults and rely on environment variables instead.
3

Publish the database migration

Publish the migration stub that creates the model_scribe_logs table. The file will appear in your database/migrations/ directory with a standard timestamp prefix.
The published migration creates the following schema:
4

Run the migration

Create the model_scribe_logs table in your database by running the standard migrate command.
Your database is now ready to receive audit log entries. Head to the Quickstart to add HasAuditLog to your first model.

Environment Variables

All of the most common configuration options can be set via environment variables in your .env file, so you don’t have to modify config/model-scribe.php directly.
Set MODEL_SCRIBE_DRIVER=file in your .env to switch the default driver to flat-file logging without touching any PHP configuration. This is useful during local development or in environments without a dedicated audit database.