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 Statistics Laravel Package

rinvex/laravel-statistics

Rinvex Laravel Statistics adds lightweight, model-based analytics to Laravel apps. Attach a trait to any Eloquent model to record and query daily, monthly, and yearly hits, views, and custom metrics via polymorphic relations, with caching and configurable tracking built in.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit. The package is a thin, Laravel-native append-only visit log: one polymorphic statistics table, a global-ish HTTP middleware (TrackStatistics), a config file, and a statistics:crush cron command that rolls raw rows into aggregates. It fits a conventional Laravel monolith where Eloquent, migrations, and the scheduler are already the operating model. It does not fit event-stream architectures, multi-tenant SaaS with per-tenant isolation requirements, or anything needing sub-minute freshness. Treat it as a validated design pattern — cheap synchronous write, scheduled rollup, SQL-native reporting — not as a capability purchase.

Integration feasibility. Low-to-moderate. Install is Composer + vendor:publish + migrate + registering one middleware; a working row-per-pageview is achievable in an afternoon. The honest effort estimate is 2–5 engineer-days to reach production-grade: audit the published migration (it likely assumes auto-incrementing users.id and may over-collect headers/bodies/IP-derived fields), prune unused columns, add indexes on created_at, user_id, request_path, is_bot, add retention, and exclude health checks, admin routes, and webhooks. Non-trivial effort concentrates in privacy review and the reporting layer, not in the install.

Technical risk. The dominant risk is not technical — it is supply chain: the repository is archived, has 0 dependents, and carries an explicit ABANDONED flag. There will be no Laravel major-version compatibility work, no security patches, and no escalation path. Secondary risks: (1) a synchronous INSERT on every tracked request, which is cheap at low volume and a real latency/table-growth problem at scale; (2) default data collection that may capture tokens or PII in headers/referrers, creating GDPR/CCPA exposure if deployed before schema review; (3) middleware ordering fragility — placed before StartSession/auth, user_id and session_id silently record as null and the data is quietly wrong rather than loudly broken; (4) opaque semantics of statistics:crush — it may prune raw data irreversibly. MIT gives legal rights, not accountability.

Key questions. Which decisions will this data actually inform — directional usage, or funnels/cohorts/attribution? If the latter, stop now and buy PostHog/Amplitude. Do we have named engineering ownership for a fork, including a maintenance budget each Laravel upgrade? What is our daily tracked-request volume, and does a write-per-request plus nightly rollup stay inside our latency and storage budget? What does our privacy posture permit us to store, for how long, and do we need consent gating before tracking? Is a two-table hand-rolled equivalent (middleware + page_views) meaningfully cheaper than adopting and adapting this? Often it is.

Integration Approach

Stack fit. Strong on Laravel 8–10-era conventions; expect friction on newer majors. Verify against your exact PHP/Laravel matrix in a throwaway branch before committing. If you use UUID/ULID keys, non-default user tables, or multiple database connections, plan to edit the published migration rather than assume it works.

Migration path. Recommended sequence: (1) vendor or fork the package into packages/ under first-party ownership and pin the reference commit; (2) do not run the stock migration — publish it, trim columns, convert user FK to your key type, add indexes, and review for stored PII; (3) register TrackStatistics only on public-facing route groups, placed after session and auth middleware; (4) add statistics:crush to the scheduler with withoutOverlapping()->onOneServer() after reading its source to confirm whether it aggregates, prunes, or both; (5) stand up your own derived summary table so dashboards never query raw rows directly. If you already have analytics, run this in parallel for 2–4 weeks and reconcile against the incumbent before cutting over.

Compatibility. Confirm the package's supported Laravel range against your version and composer.lock. Route caching and Octane are generally fine, but long-lived workers hold stale config — clear config cache and restart workers on deploy. Tests that hit tracked routes must disable the middleware (withoutMiddleware), otherwise every feature test writes rows.

Sequencing. Schema and privacy review → middleware scoped to a single route group → verify rows in tinker → build 2–3 aggregate queries → add summary table and retention → then, and only then, widen tracking to all public routes. Widening first is how teams end up with a 200M-row table and no idea which rows matter.

Operational Impact

Maintenance. Effectively permanent internal ownership. Budget a recurring line item: a half-day to a day per Laravel major upgrade to validate the fork, plus schema/index tuning as volume grows. This is the single largest cost and should be written into the adoption decision, not discovered later.

Support. No vendor, no SLA, no upstream. Compliance and security reviews must be answered by your own engineers. If a reviewer requires a named maintainer, this package fails that gate regardless of its MIT license — plan the narrative accordingly ("internal component," not "third-party dependency").

Scaling. Linear growth in the statistics table with traffic. The failure curve is gentle then sudden: queries stay fast until indexes and table size turn reporting scans into minutes. Mitigations, in order of value: exclude non-product traffic (bot flag, health checks, admin, assets), enforce a 30–90 day raw retention window with aggregates retained long-term, cache dashboard queries 5–60 minutes, and — only if volume demands — queue the write, sample 1-in-N requests, or route to a separate connection. Do not build real-time dashboards on this; the cron rollup is inherently batch.

Failure modes to monitor. Silent null user_id/session_id after a middleware-order change or route-group refactor (add a test asserting attribution). Unbounded table growth if statistics:crush is unscheduled or its retention semantics differ from assumption. Disc-space or replication lag from a high-traffic route mistakenly added to a tracked group. Config-cache staleness after .env changes. Irreversible loss of raw history if the crush command prunes without an export step. Bot false positives polluting product metrics — usable for analytics hygiene, never for security decisions.

Ramp-up. A mid-level Laravel engineer becomes productive in roughly a day on install and querying, and 2–3 days on the reporting layer and retention job. The real ramp-up cost is organizational: someone must own the fork, the privacy review, and the definition of which routes are tracked, or the initiative decays into a noisy table nobody trusts.

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.
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle