audunru/model-history
A Laravel package that keeps a history of changes to your Eloquent models. Automatically records creates, updates, and deletes so you can see who changed what and when, browse past versions, and build audit trails with a simple, lightweight API.
Architecture fit. audunru/model-history is a lightweight Eloquent audit-trail package: models opt in via a trait and history rows are written on model events. It fits applications that need change history without adopting a full event-sourcing or CDC pipeline. The v4.1.4 fix — persisting the morph alias of the owner rather than the fully qualified class name — is directly relevant to any codebase using Relation::morphMap(). That pattern is common in modular Laravel applications, so the fix improves correctness for a realistic segment of adopters rather than addressing an edge case.
Integration feasibility. Low. Integration is typically composer require, publishing config/migrations, running migrations, and adding a trait to selected models. The main integration decision is scoping which models warrant history, since every additional model increases write volume and storage.
Technical risk. Patch-level release; intrinsic upgrade risk is low. The material risk is semantic: consumers that read owner_type from history rows (admin UIs, exports, reporting jobs, tests) may previously have seen FQCNs and will now see morph aliases. Where morph maps were already enforced app-wide, the change aligns history with the rest of the schema; where maps were partial or absent, older and newer rows can diverge in format.
Key questions.
owner_type in history (UI, exports, downstream jobs), and are those readers alias-aware?Stack fit. Standard Composer-installed Laravel package; no infrastructure additions. Fits a conventional Laravel monolith or modular monolith. It does not replace a dedicated audit/compliance platform, so treat scope accordingly.
Migration path. Upgrade with composer update audunru/model-history (pin to ^4.1.4). Run any newly published migrations. If morph maps are in use, audit existing history rows and decide whether to backfill FQCNs to aliases via a one-off data migration; if morph maps are not in use, no data action is required.
Compatibility. Ensure morph map registration happens consistently at bootstrap (e.g., Relation::enforceMorphMap(...) in a service provider) so writes and reads agree. Validate against the app's supported Laravel/PHP matrix before promotion; do not assume parity with prior major versions from a patch note alone.
Sequencing.
Maintenance. Low ongoing effort; history tables are append-only and the package surface is small. The active patch cadence is a positive maintenance signal, but teams should track releases rather than assume silence means stability.
Support. Open-source, community-supported; no vendor SLA. TPM should confirm internal ownership for upgrade testing and for the morph-alias data question, since that is application-specific rather than package-specific.
Scaling. The dominant cost is table growth, not package overhead. Every audited write adds a row, so define retention/pruning and index (owner_type, owner_id) and timestamp columns early. High-write models should be deliberately included or excluded.
Failure modes.
Ramp-up. Minimal for Laravel developers — hours, not weeks. The real onboarding need is conceptual: teams must understand morph maps and audit-data retention, because that is where the v4.1.4 change has operational consequences. Plan a short internal note documenting alias conventions and history read paths alongside the upgrade.
How can I help you explore Laravel packages today?