dp-0/user-activity
A lightweight Laravel package for tracking user activity. Record actions, query activity history, and add simple audit-style timelines to your app using familiar Eloquent models. Easy to install and integrate.
Recommendation: Do not adopt dp-0/user-activity as a production dependency. Treat it as a reference implementation at most. The archived status is a hard disqualifier for direct consumption in anything with a compliance or uptime obligation.
Architecture fit. The package is a conventional Laravel drop-in: a service provider, a facade, publishable migrations and config, listeners on the framework's auth events, and middleware for page-visit capture. Coupling is low and the surface area is small, so it would slot into a standard Laravel monolith without architectural friction. The problem is fit at the ecosystem level rather than the code level — it occupies exactly the niche served by spatie/laravel-activitylog, which is actively maintained and widely understood. Choosing this package means introducing a bespoke dependency where a de facto standard exists, raising onboarding cost and reducing our ability to move engineers between projects.
Integration feasibility. Technically trivial — composer require, publish config and migrations, register middleware, done in under a day. That ease is a trap: feasibility is not the question. The real question is whether we want to own an unmaintained component, and the honest answer is only if we fork it.
Technical risk.
web guard and session auth. Multi-guard, Sanctum/token, multi-tenant, and console/queue contexts where no user is authenticated are classic failure points for this class of package.Key questions.
Stack fit. Only viable if we are on, or pinned to, Laravel 10.x with PHP 8.1/8.2. On Laravel 11+ assume work is required before first use.
Options.
| Option | Effort | Risk | Verdict |
|---|---|---|---|
| Adopt as-is | 1 day | High (unmaintained, unpatchable) | Reject |
| Fork and vendor | 3–5 eng-days + ongoing | Medium (we own it) | Acceptable if scope is genuinely small |
Switch to spatie/laravel-activitylog |
2–3 days | Low | Recommended |
| Thin in-house recorder (~200 LOC) | 3–5 eng-days | Low, fully owned | Recommended if requirements are narrow |
Migration path. Before any code changes, introduce an internal contract — an ActivityRecorder interface with a single record(event, subject, properties) method — and route all call sites through it. This makes the package an implementation detail rather than an architectural commitment. If the package is already in use, keep its table schema and event naming stable during the swap so historical rows remain queryable; the adapter changes, the data does not. Where both old and new writers must coexist briefly, dual-write behind a feature flag rather than backfilling.
Compatibility. If forking: vendor the source under packages/ with a path repository, pin an exact version, and add the fork to our CI matrix across supported Laravel/PHP combinations. Add an explicit, documented exception to dependency scanning, since upstream advisories will never arrive — this is a risk acceptance that needs a named approver, not a silent suppression.
Sequencing.
ActivityRecorder abstraction with a null/no-op driver.Maintenance. Adopting without forking means zero maintenance and zero patching — which is worse than a maintenance burden, because it is unseen risk accumulation. Forking transfers that burden to us: modest in steady state (a few hours per Laravel major), but it must have a named owner and a place in the upgrade runbook, or it will rot silently.
Support. There is no upstream support and effectively no community: 12 stars means no Stack Overflow corpus, no third-party tutorials, no one to ask. All support is internal source-reading. For a security-adjacent logging component, that is a meaningful tax on incident response.
Scaling. Model the write volume before committing. At 1M page views per day this produces roughly 365M rows per year in a single table. That requires asynchronous writes, table partitioning or time-based retention, and careful indexing for the read paths (per-user timelines, admin dashboards). Aggregate dashboard queries against a hot append-only table are the most likely source of production pain; consider a separate connection or replica for reads.
Failure modes.
Ramp-up. Low. A Laravel engineer can read the whole package in an hour; the idioms are standard. The real ramp-up cost is not the code but the semantics — deciding what constitutes a trackable event, how long to keep it, who can query it, and what "user activity" means for the product. That work is identical regardless of which library we pick, which is precisely why the library choice should default to the maintained, well-understood option.
How can I help you explore Laravel packages today?