- How do I install audunru/model-history in a Laravel application?
- Install it with Composer using composer require audunru/model-history, then publish the package config and migrations, run the migrations, and add the package trait to the models you want audited. Integration is intentionally lightweight and fits a standard Laravel monolith or modular monolith. Decide early which models warrant history because every additional audited model increases write volume and storage.
- Does audunru/model-history support my Laravel and PHP version?
- The supplied context does not list the exact Laravel and PHP version constraints for this release line. Check the package composer.json and README for the supported matrix, and validate against your application's own Laravel and PHP versions before promotion. Do not assume parity with prior major versions based on a patch note alone.
- How does the v4.1.4 morph alias change affect owner_type values?
- In v4.1.4 the package persists the morph alias of the owner instead of the fully qualified class name. That matters if your application uses Relation::morphMap(), because history rows and any consumers that read owner_type may now see aliases rather than FQCNs. Where morph maps are already enforced app-wide, this aligns history with the rest of your schema.
- Do I need to backfill existing history rows after upgrading to 4.1.4?
- If morph maps are in use, audit existing history rows and decide whether to backfill FQCN values to aliases with a one-off data migration. If morph maps are not in use, no data action is required. Rehearse any backfill on a production-like snapshot before running it in production.
- Which Eloquent models should I add history to?
- Scope history to models where an audit trail has real business or compliance value, such as records with financial, configuration, or workflow significance. Every audited model adds a row on each create, update, and delete, so high-write models should be deliberately included or excluded. Start with a small set and expand after measuring table growth.
- Does model-history record who changed a model and when?
- The package records creates, updates, and deletes through Eloquent model events, so you can browse past versions and build audit trails. The context describes seeing who changed what and when, but the practical representation of the actor depends on how your application associates and reads the owner. Confirm that your UI, exports, reporting jobs, and tests resolve that owner correctly.
- How should I handle history table growth and retention with model-history?
- The dominant operational cost is append-only table growth, not package overhead. Define retention and pruning rules early, and index owner_type, owner_id, and timestamp columns to support common history queries. Treat high-write models as an explicit inclusion decision rather than enabling history everywhere by default.
- How can I test model-history safely before production?
- Pin ^4.1.4 in a branch and run your full test suite. Exercise a morph-map-enabled model end to end with create, update, and delete operations, then verify the history rows and every read path that resolves the owner. If a backfill is needed, rehearse it on a production-like snapshot before staging and production.
- Is audunru/model-history a replacement for full audit or event-sourcing systems?
- No. It is a lightweight Eloquent audit-trail package that writes history rows on model events. It fits applications that need change history without adopting event sourcing, change data capture, or a dedicated compliance platform. Treat its scope accordingly and use a separate system if you need enterprise-grade audit controls.
- What is the maintenance and support model for audunru/model-history?
- It is open-source and community-supported, with no vendor SLA. An active patch cadence is a positive maintenance signal, but teams should track releases rather than assume silence means stability. Confirm internal ownership for upgrade testing and for application-specific questions such as morph-alias data handling.