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

Laravel Audit Laravel Package

dineshstack/laravel-audit

dineshstack/laravel-audit is a lightweight Laravel package for tracking model changes and recording audit trails. It helps log create, update, and delete events, old/new attribute values, and user context for compliance and debugging.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit

  • Framework-native Composer package. Installs as a service provider with publishable config and migrations — no sidecar, no external service, no schema in another store. This is the lowest-friction shape for a Laravel monolith or modular monolith.
  • The claimed capability set maps directly to the recurring compliance asks we get from security reviewers: field-level diffs (what changed, not just that something changed), user attribution (who), IP capture (from where), batch grouping (one logical operation spanning multiple rows), data masking (don't persist raw PII/PHI/PCI in a secondary table), and a REST API (evidence export without DB access for auditors).
  • Most teams currently hand-roll this with model observers writing to a polymorphic audits table. That works until it doesn't: pivot/relation changes go uncaptured, console and queue contexts lose the actor, multi-model transactions fragment into unrelated rows, and nobody masks anything. The package's value proposition is precisely those edge cases.

Integration feasibility

  • Single composer require, then publish config/migrations. Expect a half-day to a day for a first working integration in a mid-size app; longer if retrofitting masking policy onto existing sensitive models.
  • Main unknowns to verify before commitment: whether capture is observer-based (model events only) or also covers raw query builder / bulk update() statements — the latter is a common audit gap and a frequent auditor finding.
  • Second unknown: masking semantics. Read-time masking preserves raw values for legitimate investigation and satisfies "minimum necessary" if access to the base table is tightly controlled; write-time masking is cheaper to defend but destroys forensic value. This choice has downstream consequences for both security posture and incident response, so it needs an explicit decision, not a default.

Technical risk

  • Vendor concentration is the dominant risk. 15 stars, single maintainer, and a 9.97 score sitting next to a very small adoption footprint. That score should be treated as a signal about code quality, not about ecosystem durability. A break in maintenance is plausible within a 12–24 month horizon.
  • Laravel 13 lock-in is aggressive. The description pins to Laravel 13, which implies a recent PHP floor. Adopting ahead of our framework upgrade means the package's release cadence becomes coupled to ours. We should confirm whether the package supports a version range or only the current major.
  • MIT license is the mitigating factor. If the maintainer walks, we can fork and vendor the code. That caps the downside — but only if we keep the diff small and avoid leaning on undocumented internals.
  • Audit-table growth is unmanaged by default. Field-level diffs on large text/JSON columns can store multiples of the source data. No partitioning, retention, or archival strategy is mentioned.

Key questions for the maintainer / spike

  1. Does capture cover mass updates, insert()/upsert(), pivot table changes, soft deletes and restores?
  2. Is the audit write inside or outside the business transaction — and if inside, does an audit failure roll back the business operation? Fail-open vs fail-closed is a policy decision we must own.
  3. How is the actor resolved for queue workers, scheduled commands, impersonation sessions, and API-token auth?
  4. Is masking applied at write, at read, or both — and is the mask policy configurable per-model/per-field?
  5. What authorization model protects the REST API? Tenant scoping, rate limiting, ability to disable the routes entirely?
  6. Are writes synchronous or queueable? Synchronous writes on a hot path are a latency tax.
  7. Is there a documented upgrade path when Laravel's next major lands?

Integration Approach

Stack fit

  • Assumes a conventional Laravel app on Eloquent with MySQL/Postgres. Fits cleanly into an existing service-provider/config/migration workflow. No new infrastructure to operate — this is its main advantage over shipping audit events to a SIEM, S3, or a dedicated log service.
  • Poor fit if we are heavily query-builder-driven, use raw DB::statement for bulk mutations, or run a polyglot persistence layer. In those cases audit coverage will have holes that we would have to close ourselves, eroding the buy-versus-build case.

Migration path

  • Greenfield: trivial. Adopt early, before sensitive models accumulate, so masking policy is applied from day one rather than retrofitted.
  • Brownfield with an existing homegrown audits table: expect a schema reconciliation exercise. Decide up front whether to (a) migrate historical rows into the new schema, (b) keep the old table frozen as read-only history, or (c) dual-write for a transition window. Option (b) is usually the cheapest defensible answer for compliance — history is preserved, and no risky backfill is required.
  • Wrap the integration behind an internal interface (e.g., AuditRecorder) even though the package is framework-native. This is the single highest-leverage decision here: it makes the vendor swap a one-class change if maintenance lapses, and it lets us stub auditing in tests.

Compatibility

  • Verify against our actual PHP version and any packages that already hook model events (search indexing, cache invalidation, broadcasting). Observer-ordering conflicts are the most likely integration surprise.
  • Confirm interaction with soft deletes, UUID/ULID keys, and any custom casts — diffing a cast attribute correctly (encrypted, JSON, enum, date) is where naive implementations break.
  • Check that IP capture respects TrustProxies. Behind an ALB or Cloudflare, an unconfigured proxy trust setting will record the load balancer's IP and silently degrade the value of the field.

Sequencing

  1. Spike (1 week): install in a scratch branch, instrument two representative models — one simple, one with relations and a sensitive field. Answer the seven questions above with observed behavior, not documentation.
  2. Design decisions: masking policy (write vs read), fail-open vs fail-closed on audit write errors, retention window, and whether the REST API ships enabled.
  3. Pilot (1–2 sprints): one bounded domain, staging first, with an internal AuditRecorder wrapper and the REST API disabled.
  4. Production rollout: enable per-domain, starting with the models that appear in compliance scope (auth, billing, permissions, PII-bearing records). Instrument the hot paths for latency before and after.
  5. Audit API enablement: last, after authorization and tenant scoping are proven in staging, and behind a feature flag.

Operational Impact

Maintenance

  • Low day-to-day effort: no new service to run, monitor, or patch. The maintenance burden concentrates in two places — framework upgrades (the package must keep pace with Laravel majors) and the audit table's physical growth.
  • Retention and partitioning must be designed, not assumed. A monthly partition plus an archival job to cold storage is the minimum credible posture; without it, the audit table becomes the largest object in the database within a year for any high-write app, and query performance for auditors degrades exactly when we need it.
  • Keep the internal wrapper thin. The goal is that a future fork or replacement touches one adapter class and zero domain code.

Support

  • Support surface is essentially the maintainer plus the source. With 15 stars, expect GitHub-issue-latency, not SLA. We should staff a named internal owner who can read the package source — realistically a senior Laravel engineer, a few hours a month.
  • MIT licensing means we can patch in-house. Budget for that possibility rather than treating it as an emergency.

Scaling

  • Write amplification is the primary scaling concern: every audited mutation becomes at least one additional insert, carrying a diff payload. On high-throughput tables this is a measurable, sometimes double-digit percentage increase in write volume.
  • Mitigations, in order of preference: restrict auditing to compliance-scoped models rather than "everything"; enqueue audit writes if the package supports it; cap diff size for large text/JSON columns (hash-and-truncate beyond a threshold); partition by time.
  • Read scaling is generally fine — audit queries are auditor-driven and low-QPS. The exception is the REST API if it is exposed broadly; rate-limit and scope it.

Failure modes

  • Audit write failure: the most consequential decision. Fail-closed (roll back the business transaction) guarantees an unbroken trail but converts an audit-table problem into an outage. Fail-open preserves availability but creates silent gaps — unacceptable for regulated scope. Recommended: fail-closed for in-scope regulated models, fail-open elsewhere, with a metric and alert on every swallowed failure.
  • Silent coverage gaps: bulk operations and raw queries bypassing model events. Detect with a periodic reconciliation job comparing row counts/checksums between source and audit tables for in-scope models.
  • Actor misattribution: queue and console contexts defaulting to null or to a stale user. Verify and, if needed, propagate a correlation ID through job payloads.
  • PII leakage into the audit store: the audit table becomes a shadow copy of sensitive data, often with weaker access controls than the source. This is a real regulatory exposure (GDPR erasure requests, HIPAA minimum-necessary) and the reason masking must be a day-one decision, not a follow-up ticket.
  • Vendor abandonment: a Laravel major lands, the package lags, and we are pinned. Detectable early via the upgrade spike; the fork path is viable because of the MIT license.

Ramp-up

  • Engineering: low. Any Laravel developer is productive in under a day; the learning is in the configuration semantics, not the API.
  • Security/compliance: moderate. Someone must own the masking policy, retention schedule, and access controls on the audit store and its API — and be able to evidence them to an auditor. That work is ours regardless of the package.
  • Overall: the package removes implementation toil, not accountability. Treat it as an accelerator for a control we already own, wrapped in an internal interface, scoped deliberately, and backed by a named owner and a documented exit path.
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.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core