overtrue/laravel-versionable
Laravel Versionable is a minimalist package that adds version history to your Eloquent models. Track only changed attributes, keep a set number of versions, whitelist or blacklist fields, and easily revert to any specified version.
Architecture fit
use Versionable) backed by a polymorphic versions table. This is the canonical Laravel shape for revision tracking and composes cleanly with the existing model lifecycle (created/updated/deleted events) without forcing a repository or service-layer rewrite.DIFF (default, records only changed attributes) and SNAPSHOT (full versionable attribute set). DIFF keeps payload small for wide tables with a narrow edit surface; SNAPSHOT trades storage for trivial point-in-time reconstruction and simpler audit semantics. The choice is per-model and is the most consequential architectural decision a team will make with this package.withoutVersion() allows suppressing that; correctness here depends on the versioned model's casts/observers, not the package.jfcherng/php-diff. That keeps the package minimal but introduces a second dependency (and a second security/support surface) if diff UI is exposed to end users.$versionModel and trait config, supporting multi-DB and multi-tenant shapes without forking.Integration feasibility
composer require, vendor:publish, artisan migrate, add the trait, declare $versionable (whitelist) or $dontVersionable (blacklist). No queue, cache, external service, or schema change to the parent table.mansoorkhan96/filament-versionable) covers the most common admin-panel UI path.Technical risk
removeVersion*/forceRemoveVersion* APIs exist; there is no built-in TTL or pruning job. At scale this is the primary long-term risk and a TPM must assign an owner to it.isForceDeleting guard in 5.2.2). Mature but still interacting with a very large framework surface; your own regression tests are the safety net.overtrue) with community PRs. 586 stars and no listed dependents indicates a modest ecosystem footprint. MIT plus small surface area means it is forkable, but security/compat maintenance is best-effort.Key questions
Stack fit
composer require; do not let Composer resolve a major that silently drops supported PHP versions.Migration path
versions table indexes against expected query patterns (by model, by model + created_at for versionAt(), by model + version number, and a created_at index for retention).$versionable as an explicit whitelist rather than relying on blacklist defaults.forceRemoveVersions by created_at cutoff) before enabling on any high-write model.Compatibility
isForceDeleting guard); custom $versionModel and custom foreign keys support multi-tenant; lazy loading is intentionally prevented, so list views must eager-load versions.$stripTags when rendering untrusted user content into HTML.Sequencing
versionAt() latency, and eager-load cost on list views.Maintenance
AGENTS.md guidance (minimal diffs, no public API changes, no unnecessary dependencies) is a positive maintenance-discipline signal.Support
jfcherng/php-diff dependency is a second support surface; audit it separately if diff rendering is exposed to end users.Scaling
(versionable_type, versionable_id, version_number), (versionable_type, versionable_id, created_at) for versionAt(), and a standalone created_at index for pruning.with('versions') — a safety default that shifts cost into query design rather than runtime surprises.Failure modes
versionAt() scans. Mitigation: retention job, row-count alerting, archive tier.$versionable whitelist means revert "succeeds" but does not restore that column. Mitigation: encode the versionable contract in tests and treat the whitelist as a reviewed artifact.withoutVersion plus downstream suppression.Ramp-up
versions, latestVersion, versionAt, getVersion()->revert(), withoutVersion, diff). A day of pairing is enough to ship a pilot on a non-critical model.How can I help you explore Laravel packages today?