esplora/memento
Memento is a Laravel package for versioning Eloquent models. It captures snapshots of model state, helping you track changes and restore previous versions, adding simple audit history and model revision support to your application.
^3.0 only if you're on Laravel 10 + PHP 8.2; otherwise stay on ^2.0 for now.composer require esplora/memento and run the package migrations before touching any model. Snapshot data lives in its own table, so the migration is not optional.save(). If the package hooks into the updated event by default, use an escape hatch (saveQuietly(), a guard attribute, or a custom event list) so noisy fields like last_seen_at or counters don't generate snapshots.DB::transaction() and follow with whatever your app normally does on a state change — fire your own event, reindex, notify.auth()->user() is null, so snapshots end up unattributed. Pass the actor through (e.g. Auth::login() in the job, or a package-supported actor override) if provenance matters.@test / docblock annotations to attributes (#[Test]) and setUp(): void signatures if you're porting an app test suite alongside the upgrade.composer.json constraints, run the full suite, and specifically re-test anything that touches snapshot serialization — model $casts, date formats and Carbon versions are the usual sources of silent drift between Laravel majors.composer why-not esplora/memento 3.0.0 before assuming a dependency conflict is the package's fault.created_at, and prune aggressively.$hidden, $appends and custom accessors determine what lands in the payload. Change a cast later and old snapshots still hold the old representation — restoring an old snapshot can therefore write a value your current cast doesn't handle. Test restore paths after any cast/attribute change.updated (audit logs, webhooks, cache busting, Scout indexing) will not fire. Do it manually.Bus::fake()-style jobs or an actual queued run before shipping.$fillable/$guarded and whether the write went through saveQuietly() or a raw query builder update — bypassing Eloquent bypasses the package entirely.composer.json ("esplora/memento": "^3.0") and read the full changelog diff between 2.0.0 and 3.0.0 before deploying — the release notes here are terse, so the actual diff is where any behavioural changes would hide.How can I help you explore Laravel packages today?