konekt / history
Eloquent Model History for Laravel
Fund package maintenance!
fulopattila122
Installs: 1 382
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8.1
- illuminate/database: ^10.10.1|^11.0
- illuminate/support: ^10.10.1|^11.0
- konekt/concord: ^1.13
- konekt/enum: ^3.1|^4.0
- konekt/enum-eloquent: ^1.9
- konekt/laravel-migration-compatibility: ^1.6
Requires (Dev)
- orchestra/testbench: ^8.0|^9.0
- phpunit/phpunit: ^10.0
README
This package provides features to log changes, diff and comments to Eloquent models.
$task = Task::create(['title' => 'Get milk', 'status' => 'todo']); History::begin($task); $task->update(['status' => 'done']); History::logRecentUpdate($task);
Features
- Record model creation, update, delete, and retrieval
- Add optional comments to events
- Add comment-only history events
- Automatically record the IP, URL, user agent and user ids when in an HTTP context
- Automatically detect the CLI, the command name when in an artisan command
- Automatically detect the queue and the job when running in a queued job
- Define included/excluded fields on a per-model basis
- Has a diff of the changed fields (old/new values)
Requirements
It requires PHP 8.1+ and Laravel 10 or 11.
It has been tested with SQLite, MySQL 5.7, 8.0 & 8.2 and PostgreSQL 11, 12 & 16.
It is known that this library, Laravel 11.0 and PostgreSQL 11 don't work together, therefore it is recommended to use at least Postgres version 12 or higher in case your DB engine is Postgres.
Documentation
For Installation and usage instruction see the Documentation; https://konekt.dev/history/master