Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

History Laravel Package

panoscape/history

Eloquent model history tracking for Laravel. Add the HasOperations and HasHistories traits to record who changed which model, then browse a timeline of operations via the History facade. Includes migrations, config, and translations.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit panoscape/history is a bolt-on audit trail for Laravel Eloquent, implemented as two traits: HasOperations on the acting user and HasHistories on tracked models. It hooks Eloquent model events (created, updating, deleting, restored), plus a ModelChanged event for custom entries, and persists rows into a single published histories table exposed through polymorphic relationships ($model->histories(), $user->operations()). For a TPM, that means adoption is measured in hours per model, not weeks: no schema redesign, no service layer, no queue infrastructure required. It fits CRUD-centric admin domains (CMS, back-office, config management) where "who did what, when" is a compliance or support requirement. It is a poor fit for high-write, event-sourced, or ledger domains, where synchronous per-save inserts and a generic diff column become a bottleneck rather than an asset.

Integration feasibility Low friction: Composer install, publish migrations/config/translations, add two traits, implement getModelLabel(). The package ships deliberate production guardrails that a TPM should treat as features to plan around: event whitelist, per-model attribute blacklist (password/PII redaction), user-type blacklist, environment blacklist, and global/runtime toggles including console_enabled and test_enabled (both default off). Multi-guard auth is supported via auth_guards (full scan or ordered array). Localization of model names and event messages is first-class, which matters for multi-locale products and non-English admin surfaces.

Technical risk

  • Maintainer concentration. One principal maintainer, Laravel-version bumps largely via laravel-shift automation. No dependents and ~163 stars are weak adoption signals; budget for a fork-or-vendor contingency. Compare against spatie/laravel-activitylog and owen-it/laravel-auditing before committing.
  • Data model limits. History is append-only text/diff, not a queryable version graph. You cannot efficiently answer "state of record X at time T" without replay, and JSON meta diffing limits analytics without DB-specific JSON queries.
  • Synchronous write path. Recording appears coupled to the model save lifecycle; an exception or slow insert can affect primary writes. Whether failures are swallowed or propagated is undocumented — treat as a blocking question.
  • No retention/backfill story. No pruning, archival, or historical backfill for pre-existing rows; the audit trail starts at install date.
  • Known defect. On update, the message label reflects the new attribute value, not the original; a getOriginal() workaround exists but must be applied discipline-wide.
  • Compliance gaps. No built-in erasure/anonymization tooling for GDPR/DSAR, no PII classification, no tamper-evidence (no hash chaining).

Key questions

  1. Do history-write failures raise into the request, or are they silently dropped? What is the blast radius on transaction rollback?
  2. What indexes ship with the migration (model_type/model_id, user_id, performed_at)? Will it survive at 10M+ rows?
  3. Is the write synchronous only, or is a queued listener feasible without forking?
  4. What is the retention policy, and who owns the purge job?
  5. Does morph-map support (v2.9.0) cover our multi-tenant/namespace setup?
  6. Who forks the repo if the maintainer goes dark, and what is the version-pin policy?

Integration Approach

Stack fit Strong for standard Laravel monoliths on Eloquent with default or multi-guard auth, MySQL/Postgres, and a Blade/Inertia admin surface. Weaker for multi-tenant apps (no tenant scoping in the schema — likely needs a global scope or tenant_id migration), and for apps where writes go through jobs/queues, since console_enabled defaults to false and would silently suppress worker-generated history.

Migration path Additive and reversible: publish and run one migration, add one config file, add translations. No changes to existing tables or model schemas. The real work is policy, not code: agree which models are tracked, which attributes are blacklisted, which events are whitelisted, and whether to redact actors (user_blacklist) for system/admin operations. Enable in staging first, verify row volume and diff quality, then promote.

Compatibility Advertised support spans Laravel 6.x–13.x, with a ^1.0 branch only for 5.6. That breadth is reassuring for long-lived apps but also signals a shim-style codebase; verify against our exact Laravel/PHP matrix in CI rather than trusting the badge. v2.9.0 added Laravel 13 and morph-map support, so pinning to ^2.9 is the sensible floor.

Sequencing

  1. Spike (1–2 days): install in a scratch branch, track 2–3 low-risk models, inspect the histories payload and message output.
  2. Decide build-vs-buy vs. spatie/laravel-activitylog; document the rationale.
  3. Define the tracking policy matrix (models × events × blacklisted attributes × actors).
  4. Add tenant scoping and the retention/purge job before enabling on sensitive models.
  5. Roll out by domain: content/config first, then users/billing with redaction, then anything under regulatory scrutiny.
  6. Ship an admin read surface (history tab on detail pages) so the investment is visible to support and compliance teams.

Operational Impact

Maintenance Very low code-surface maintenance — one config, one migration, two traits. The genuine upkeep is policy drift: new models added without HasHistories, new sensitive attributes omitted from the blacklist, and the getModelLabel() original-value workaround forgotten on newly tracked models. Convert those into PR-checklist items and a periodic audit. Repository maintenance risk sits with a single maintainer; plan a quarterly "is upstream still healthy?" review and keep a vendored fork path warm.

Support No commercial SLA; MIT with GitHub issues. Expect to self-serve bugs. Mitigate with a pinned version, a regression test around the history contract, and an internal owner (one backend engineer) who can read the package source. Because the package is small and trait-based, the "debug by reading vendor code" cost is genuinely low.

Scaling Cost is one insert per tracked write event, plus JSON meta. That is acceptable for back-office throughput (hundreds of writes/minute) and risky for high-volume tables (millions/day). Levers: whitelist events narrowly, blacklist noisy attributes, disable tracking in console/queue contexts where it isn't wanted, partition or archive histories by performed_at, and add composite indexes ahead of growth rather than after. The admin read path ($model->histories()->latest()) needs pagination and an index on (model_type, model_id, performed_at) from day one.

Failure modes

  • History insert raises → user-facing save fails or transaction rolls back (must be verified and, if needed, wrapped in try/catch or deferred).
  • Silent gap during queued/console writes → audit trail looks complete but isn't; document this explicitly for compliance stakeholders.
  • Actor attribution loss with non-default guards → all hasUser() false until auth_guards is configured.
  • Stale/deleted model referenced by a history row → model() returns null; admin UI must handle orphans.
  • Unbounded table growth → query and backup degradation; no built-in prune.
  • Misleading update messages (new label instead of old) in forensic or dispute contexts.

Ramp-up Days, not weeks. A mid-level Laravel developer can be productive in under a day from the README alone; the learning curve is dominated by policy decisions (what to track, what to redact, how long to keep) rather than by the API. Budget roughly one engineer-week for the pilot plus policy definition, and one additional week for the admin read surface, retention job, and tenant scoping — the package is the cheap part of the initiative.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
ably/pubsub-server
mstfkhazaal/defender
mfonte/base62x
karnoweb/metapilot
tobya/bcsapiwrapper
swalker2/cpanel
vish4395/laravel-translation-manager
morningtrain/economic
teksite/systeminfo-laravel
atomcms/voting
run6/weather
siokas/laravelembeddirectives
adamlien/pkuuids
gilsonsouza/lara-doc-generator
manelgavalda/enrollment_mobile
unabomber/timezone
delatbabel/contacts
astritzeqiri/g-recaptcha
kevinongko/laravel-genode
developeruz/laravel-analytics