cieplik206 / model-audit
The auditing & accountability package for Laravel's Eloquent ORM.
Requires
- php: ^8.3
- ext-json: *
- illuminate/console: ^12.8|^13.0
- illuminate/database: ^12.8|^13.0
- illuminate/filesystem: ^12.8|^13.0
Requires (Dev)
- ext-pdo: *
- altek/eventually: ^3.0
- orchestra/testbench: ^10.0|^11.0
- roave/security-advisories: dev-latest
Suggests
- altek/eventually: Required for keeping track of BelongsToMany and MorphToMany relations.
Provides
None
Conflicts
Replaces
None
README
A maintained fork of Altek Accountant, based on v5.0.0. It records Eloquent model and relationship changes. The package keeps the upstream PHP namespace, configuration, ledger schema and signature format.
Installation
composer require cieplik206/model-audit:^5.0.2
When migrating from altek/accountant, replace that requirement in your root composer.json with cieplik206/model-audit and remove any VCS override for this fork before updating the lock file. Existing installations can keep using their ledger table. For a new installation, see the package documentation.
Worker isolation
Eloquent restore, sync and toggle operations can emit secondary events while they execute. The observer suppresses those secondary events within the active model or relationship call. A cancelled operation or an exception can no longer leave a suppression flag active for later work in the process.
Development
Run composer install, then vendor/bin/phpunit tests/Unit/RecordableObserverTest.php tests/Integration/RecordingTest.php. Integration tests use an in-memory SQLite database.
Released under the MIT license. Original package by Quetzy Garcia.