sbarre/eloquent-versioned
Keep a full revision history for your Eloquent models: automatically store versions on save, browse past changes, and restore earlier states. Handy for audit trails, undo, and content workflows in Laravel apps.
Architecture fit: This package provides model versioning/history for Eloquent models, a common need for audit trails, content revision, and undo workflows. Laravel 5.2 compatibility (0.1.2) widens the addressable install base into the LTS-era ecosystem, but 5.2 is EOL — treat this as a signal for legacy maintenance, not new greenfield adoption. Fit is strongest for internal admin tooling and CMS-style content, weaker for high-write transactional tables.
Integration feasibility: Low ceremony — versioning is typically enabled via a trait on target models plus a migrations publish step. The two new traversal helpers (getNextModel(), getPreviousModel()) reduce custom glue code for "previous/next revision" UI and diff navigation. The improved model_id determination addresses a race condition class that previously could corrupt history attribution under concurrent writes — a meaningful reliability fix worth validating against our write concurrency patterns.
Technical risk:
0.1.x) semver implies API churn; methods and table schema are not yet a stability contract.Key questions:
model_id fix require a migration or index change on the versions table?getNextModel()/getPreviousModel() ordered by ID or timestamp, and how do they behave at boundaries and with soft-deleted records?Stack fit: Drop-in for Eloquent-centric Laravel apps. Assumes standard relational DB (MySQL/Postgres); behavior on SQLite is fine for dev but concurrency semantics don't carry over. No queue/event infrastructure required, though write amplification should be considered for high-volume models.
Migration path: No prior assessment exists, so treat this as first-time evaluation rather than an upgrade. Start in a non-production branch: publish config/migrations, apply the trait to one low-risk model, and exercise create/update/delete/restore plus concurrent writes. The 0.1.2 model_id change may alter how IDs are resolved — re-verify existing version rows still map correctly before promoting.
Compatibility: Confirm the framework version we target. If we are on 5.2, this release is enabling; if on a newer Laravel, pinning to 0.1.2 may not be viable and we should evaluate the maintenance status before committing. Pin the exact version in composer.json and lock the versions table schema.
Sequencing:
model_id fix holds under load and that no DB constraint is needed.(model_type, model_id) and ordering column.Maintenance: Pre-1.0 with community contributions ("thanks Andrew") signals a small maintainer base. Expect to own patches or fork if we depend on it long-term. Budget review time per Laravel upgrade; Laravel 5.2 alignment means upstream drift is likely.
Support: No commercial support implied. Operational reliance means documenting the versions table schema and traversal behavior internally so the team can debug independently. Establish a fallback: a thin internal wrapper over the trait isolates us from API changes.
Scaling: Version history is append-heavy — every write produces an additional row. Estimate row growth per high-traffic model and plan partitioning or archival. getNextModel()/getPreviousModel() imply per-call queries; ensure indexes cover the ordering column to avoid table scans on large history tables. The improved model_id resolution should reduce lock contention risk, but re-benchmark concurrent write throughput post-adoption.
Failure modes:
model_id attribution under concurrent inserts — validate the 0.1.2 fix under contention.null at boundaries without clear contract — UI must handle.Ramp-up: Low for a Laravel developer — trait-based, minimal config. Moderate for the team to internalize traversal ordering semantics and history retention policy. Allocate a half-day spike and a short internal doc covering versioning scope, concurrency validation results, and archival strategy before broad rollout.
How can I help you explore Laravel packages today?