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

Loggastic Laravel Package

locastic/loggastic

Loggastic is a Laravel package for logging user activity and model changes. It records who did what and when, helping you build audit trails and simplify debugging. Lightweight and easy to drop into existing Laravel applications.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit

  • Still a Symfony bundle, not a Laravel package — that remains the single most important finding. No service provider, no facade, no publishable config, no Laravel integration tests. Nothing in 2.1.0 changes this.
  • What 2.1.0 does change is the dependency footprint. The 2.0 storage abstraction is now realized: storage: elasticsearch | doctrine | in_memory. When the backend is not Elasticsearch, no ES services are registered at all — no client, no elastic_* config, no PSR-18 requirement. That removes the single heaviest piece of infrastructure coupling in the original assessment.
  • The doctrine backend is genuinely portable in a way the ES backend was not. It targets DBAL 3.8+ and 4.x, runs on PostgreSQL/MySQL/SQLite, uses JSON columns with an indexed discriminator column, normalizes timestamps to UTC, and makes tracker writes upserts. That is a sane schema and it is the part worth reusing.
  • Fit verdict moves from "poor stack fit, good conceptual fit" to "poor stack fit, good conceptual fit, and now a materially cheaper port." The reusable surface is larger: schema design, storage abstraction boundary, and a test double (in_memory) ship in the box.

Integration feasibility

  • Still a pattern port, not a dependency. But the port is meaningfully smaller and the acceptance criteria are now testable without standing up a cluster.
  • Two viable paths now exist, and they have different cost profiles:
    • Doctrine/DB path (new, preferred first target): reuse the two-table schema and upsert semantics, re-implement wiring as a Laravel package using DB/query builder or Eloquent, ship Laravel migrations that mirror the DBAL-created schema. Avoids Doctrine DBAL entirely if we translate the small adapter.
    • ES path: unchanged from the prior assessment — extract the document model and write path.
  • Effort estimate revises downward for the DB path: the spike is now hours-to-a-day (no cluster provisioning, in_memory gives a working reference for sort/pagination/per-class isolation semantics), and the productionization window compresses from one-to-two weeks toward roughly one week, assuming we write our own migrations rather than adopting DBAL's schema API.
  • Direct adoption is still possible only by pulling Symfony components plus, now, doctrine/dbal into the container graph. The new explicit doctrine/dbal (^3.8 || ^4.0) dependency is a second DB abstraction layer sitting beside Eloquent — a cognitive and maintenance tax we should not pay for a logging concern.

Technical risk

  • Adoption signal unchanged and still weak: 38 stars, 0 dependents. Single-vendor library, no ecosystem validation, vendor abandonment is a realistic scenario. 2.1.0 shipping a substantive feature is mildly positive evidence of maintenance but does not change the structural risk.
  • New dependency risk: doctrine/dbal is now a hard dependency. For a Laravel app this is not free — Laravel dropped its DBAL requirement for column modification, so we would be reintroducing it solely to satisfy a logging library's adapter.
  • Schema ownership conflict (new, important): the Doctrine adapter creates its schema through the DBAL schema API, not migrations. A Laravel team expects php artisan migrate to be the source of truth. Reconciling two schema-management mechanisms is a real integration hazard and the most likely source of friction in a direct-adoption scenario.
  • Reduced infrastructure risk: the ES cluster provisioning dependency, index-template/ILM prerequisite, and ES 7→8 client breakage point all disappear on the Doctrine path. That was previously a top-three risk.
  • Version coupling risk is narrower but not gone: Symfony major version coupling remains (it is still a bundle); DBAL 3.8+/4.x is covered in CI, which is better hygiene than most single-vendor packages demonstrate.
  • Metadata anomaly on release dating from the prior assessment remains unverified; 2.1.0 does not resolve it.
  • Licensing remains clean (MIT); the extract-and-own path stays legally frictionless.
  • No breaking changes — default stays elasticsearch, upgrade from 2.0.0 is a plain composer update. This is relevant only if we had already adopted 2.0.0, which we have not; treat it as a signal of release discipline, not as a migration task for us.

Key questions

  • New: Is the storage abstraction a clean interface we can implement against a Laravel-native adapter, or is the Doctrine adapter entangled with DBAL-specific type conversion that we would have to re-create? This determines whether the DB path is a one-week or three-week port.
  • New: Does the Doctrine schema ship as versioned migrations anywhere, or only via the DBAL schema API? If the latter, we must treat the schema as ours to own and version.
  • New: Are the two tables (activity logs, current data trackers) multi-tenant-ready, or does tenant scoping require a schema change on our side?
  • New: Does the in_memory backend cover the same code path as the real backends (i.e., can it serve as a contract-test fixture), or is it a simplified stub?
  • New: On the Doctrine path, are writes synchronous within the request, or is there a buffer/messenger path? This decides whether we inherit primary-database write amplification per logged event.
  • Retained: what is the document/row schema for free-form activity payloads, and does it accommodate PII redaction? Is payload structure fixed or arbitrary JSON?
  • Retained: is the Elasticsearch transport abstracted, and which ES major is supported? (Now lower priority — only matters if we pick the ES path for high-volume cases.)
  • Retained: does the write path depend on Symfony's EventDispatcher or Doctrine event listeners for activity capture, or is it a standalone Monolog handler?

Integration Approach

Stack fit

  • Conceptual fit improves to good. The Doctrine backend aligns with a Laravel estate that already has a relational database and does not want to operate an Elasticsearch cluster for audit logs.
  • The natural Laravel shape is now simpler: a queued listener or dedicated logging channel → a Laravel storage adapter → either the app database (two tables, JSON payload column, indexed discriminator) or Elasticsearch for high-volume domains. The storage abstraction maps cleanly onto a Laravel contract/interface with two driver implementations.
  • in_memory gives us something the prior version lacked: a zero-dependency test backend that lets us assert on sorting, pagination, and per-class isolation in our own test suite.

Migration path

  1. Source review and spike (short): audit the storage interface, the Doctrine adapter, and the schema definition. Stand up the two tables in a throwaway Laravel app via hand-written migrations and write sample activity and tracker rows through an Eloquent adapter. Validate upsert idempotency on tracker writes and UTC timestamp normalization.
  2. Extract and wrap: vendor (or fork under MIT) the portable storage interface and schema design. Ship a Laravel package: config file, migrations, a Loggastic-style facade, an Eloquent/query-builder driver, and the in_memory driver as a test double.
  3. Defer Elasticsearch: keep an ES driver as a documented extension point, not a deliverable. Only build it if volume data proves the relational path insufficient.
  4. Adopt incrementally: enable for one bounded domain (auth and admin actions) before broadening.
  • Fallback remains spatie/laravel-activitylog plus a custom storage driver if we prefer a supported Laravel-native base — now a closer call than before, since the DB-backed target state is similar and the third-party surface we avoid is larger.

Compatibility

  • Pin and document: PHP version, Laravel version, database engine and version, and (if built) the Elasticsearch and ES client majors. Cover with contract tests that run against SQLite and at least one production-grade engine (PostgreSQL or MySQL) — JSON column behavior differs meaningfully across those, and the upstream CI covering DBAL 3.8+/4.x does not prove our engine's JSON semantics.
  • Verify JSON column support and indexing behavior on our target engine specifically; the "runs on anything DBAL supports" claim is true at the adapter level but performance and index behavior on JSON columns are engine-specific.
  • If any path retains direct bundle usage, pin the Symfony major and note the doctrine/dbal constraint conflict surface with the rest of the estate.

Sequencing

  • The previous blocking dependency chain — ES cluster provisioning → index templates/ILM → write path spike → wrapper — collapses. Database readiness replaces it, and the app database already exists. This removes the single largest schedule gate in the prior plan.
  • Revised chain: schema design and migration authoring → storage interface extraction → Laravel adapter plus in_memory test double → domain rollout. Can run in parallel with other application work; it no longer needs to be isolated.

Operational Impact

Maintenance

  • We still inherit the burden, but the extraction surface is different in shape: less Elasticsearch client plumbing, more schema-and-adapter work. Net code volume is comparable, likely modestly lower — budget roughly 400–1,200 lines of glue plus migrations.
  • Owning the schema is now mandatory rather than optional. That is a real, ongoing obligation: migrations, index review, and retention enforcement are ours.
  • The doctrine/dbal dependency is avoided entirely on the extraction path; on a direct-adoption path we would be tracking both Symfony and DBAL majors. Another point for extraction.

Support

  • Unchanged and still thin. No commercial support, small agency, single bundle, near-zero community. Escalation is a GitHub issue or a self-fix.
  • Mildly improved signal: 2.1.0 delivered a substantive feature with CI coverage across two DBAL majors and explicitly documented no-breaking-change upgrade. Better hygiene than the prior data point suggested, but not a substitute for community depth.

Scaling

  • The scaling story now bifurcates, and this is the most consequential new consideration.
  • Relational backend: audit writes land on the primary application database. That means write amplification on the same resource serving user traffic, table growth in a database not designed for append-only high-volume logs, and retention enforced through partitioning or scheduled deletes. For low-to-moderate audit volume (auth events, admin actions, config changes) this is fine and operationally simpler than a cluster. For high-volume or high-cardinality event streams it is the wrong tool and will contend with production traffic.
  • Elasticsearch backend: scaling characteristics unchanged — dominated by ES, with ILM/rollover and retention mandatory. Activity logs grow monotonically; without retention the index becomes a cost problem within months.
  • Decision rule to document: relational for bounded audit domains, Elasticsearch for high-volume or search-heavy domains. The storage abstraction makes this a config decision rather than a rewrite, which is the genuine architectural win of 2.1.0.
  • Prefer queued/async writes on both paths to decouple application latency from storage latency.

Failure modes

  • Primary database contention (new): co-locating audit writes with transactional traffic means logging can degrade the app database under load. Mitigate with a separate connection/schema, queued writes, and batching.
  • Unbounded table growth (new): without partitioning and a retention job, the activity table becomes an operational and cost problem and can degrade application query performance on shared infrastructure. Establish retention at design time, not after the first incident.
  • Schema drift (new): if the DBAL schema API and our Laravel migrations both claim ownership, schema state diverges across environments. Pick one owner — migrations — and treat upstream schema as reference only.
  • ES unavailable: only applies if the ES driver is built. It must fail open; a logging library taking down checkout is an unacceptable blast radius.
  • Silent log loss: still the core observability gap on any fail-open path. Emit a metric on dropped/failed writes so audit completeness is measurable.
  • Mapping explosion: ES-path only, but still real — enforce a fixed mapping and flatten payloads.
  • Queue backlog: if writes are queued, a stalled worker silently accumulates audit gaps. Alert on queue depth and worker health. Applies equally to the relational path.
  • PII leakage: unchanged and still the highest-severity risk. Audit events capture user-supplied data; redaction must be enforced in the writer, never delegated to callers.

Ramp-up

  • Application-engineer ramp-up is now genuinely low: hours to understand the usage model, one to two days to be productive on the extracted package. The DB path is familiar territory for any Laravel developer.
  • The prior blocker — Elasticsearch operational literacy as a prerequisite platform-team skill — is no longer mandatory. That is the largest total-cost-of-ownership reduction in this release, and it is what makes the package worth revisiting at all.
  • Residual specialist need is ordinary relational discipline: migrations, indexing, partitioning, and retention. Most Laravel teams either have this or can acquire it cheaply.
  • ES literacy becomes a conditional cost, incurred only if volume forces the ES driver. That is a deferrable decision rather than an up-front gate — a materially better risk posture than the version previously assessed.
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.
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
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console