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 Page Visits Laravel Package

jeffersongoncalves/laravel-page-visits

A lightweight Laravel package for tracking page visits in your app. Record visits to routes and pages to see traffic patterns and popular content, without relying on external analytics services. Simple to install, configure, and extend.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit

  • The package remains a self-contained, Laravel-native analytics add-on: publishable migrations, an artisan aggregation/prune command, and a dedicated daily-stats table (page_visit_daily_stats). Nothing in 1.3.0 changes where it sits in the stack.
  • The new response_time_stats column (count, avg, min, max, p50, p95, p99 in ms) materially increases the package's value: it shifts the package from pure traffic counting to lightweight performance monitoring, which overlaps with tools like Telescope, Pulse, or an APM vendor. Worth an explicit "do we still need X?" conversation.
  • Percentiles computed with SQL aggregates is the architecturally correct choice — flat memory on high-traffic days — but it hard-couples the feature to what the underlying database engine can do (window functions / ordered-set aggregates).

Integration feasibility

  • Effort is low: vendor:publish --tag="page-visits-migrations" then php artisan migrate adds one nullable column. No application code changes are required to upgrade.
  • Consuming the metrics is where the work is: whoever builds reporting must handle null (days with no timed visit) and must confirm what "response time" measures (server-side request duration, presumably, not browser/RUM timing).

Technical risk

  • Database capability risk (primary): SQL-based p50/p95/p99 generally needs MySQL 8+, PostgreSQL, or equivalent. MariaDB/older MySQL 5.7 deployments may fail or silently degrade. This is the single biggest unknown for a TPM to resolve before committing.
  • Migration risk on large tables: adding a nullable column is usually fast/metadata-only on modern MySQL/Postgres, but should still be scheduled and tested against production-sized tables.
  • No historical backfill: existing daily rows will have null stats. Any dashboard or alert built on this will show gaps for all dates before the upgrade — plan the "data starts here" conversation with stakeholders up front.
  • Metric-definition risk: a response-time percentile that excludes/excludes certain routes (health checks, admin, API) or that captures only a subset of visits (count vs. total visits) can mislead. Confirm how count relates to the day's visit count before anyone publishes an SLO against it.

Key questions

  1. Which database engines/versions are officially supported for the SQL percentile computation, and what is the fallback on unsupported ones — error, or null?
  2. How is response time captured and scoped — server-side only? Which requests are instrumented, and are excluded paths configurable?
  3. Is response_time_stats stored as a single JSON column or discrete columns? What is the shape and stability of that contract for downstream consumers?
  4. Does the prune half of page-visits:aggregate-and-prune ever remove stats rows before aggregation, and what is the default retention window?
  5. Is there an official upgrade note or changelog entry for 1.2.x → 1.3.0 beyond the migration (no breaking changes stated, but confirm no config or command signature changes)?
  6. Is percentile computation approximate (histogram/bucket-based) or exact? This determines whether the numbers are dashboard-grade or SLO-grade.

Integration Approach

Stack fit

  • Standard Laravel package shape: service provider, publishable migrations, artisan command, scheduler hook. Fits existing deploy, config, and migration conventions without introducing new infrastructure.
  • Pairs naturally with the app's existing scheduler (Schedule::command('page-visits:aggregate-and-prune')->daily()) and requires no queue worker or external service.

Migration path

  1. Publish the migrations tag and inspect the generated file before running — confirm nullable, confirm no default, confirm no index surprise.
  2. Apply in a low-traffic window; verify runtime and lock behavior on a staging copy sized like production.
  3. Deploy 1.3.0 code; the column is additive and nullable, so rollback to 1.2.x is safe from a read standpoint (old code simply ignores the column).
  4. Enable/adjust the scheduled aggregation run and confirm it writes non-null stats on the first run.

Compatibility

  • Backwards compatible at the schema level (nullable addition). Any existing consumer of page_visit_daily_stats keeps working.
  • Forward compatibility concern: consumers written against 1.3.0 must treat response_time_stats as nullable forever, since gaps are expected by design.
  • Pin the package version in composer.json and verify the ORM/DB driver combinations used across dev, CI, and production are identical — percentile behavior diverging between CI (often SQLite) and production (MySQL/Postgres) is a realistic trap.

Sequencing

  • Phase 1: upgrade + migrate, no consumer changes. Let data accumulate for 1–2 weeks.
  • Phase 2: build/validate read path (dashboard or export) with explicit null handling; sanity-check p50/p95 against logs or an APM sample for the same day.
  • Phase 3: only then consider alerting or SLO commitments. Do not gate releases or on-call rotations on a metric with two weeks of history and an unconfirmed capture scope.

Operational Impact

Maintenance

  • Low steady-state burden: one scheduled command, one table, one migration. The SQL-aggregate approach means no memory tuning and no long-running PHP loops as traffic grows.
  • Ongoing cost is mostly schema/consumer maintenance — any change to the stats shape is a downstream contract change for whoever reads it.

Support

  • Expect support tickets of the form "response time shows blank for last month" (pre-upgrade dates) and "p95 looks wrong." Prepare a one-page internal note covering: metric definition, capture scope, null semantics, and known DB requirements. This preempts most questions.
  • No vendor support channel implied; assume community/issue-tracker support and budget accordingly.

Scaling

  • Aggregation cost scales with visits-per-day but stays memory-flat; the remaining scaling risk is table growth of page_visit_daily_stats (one row per day, so effectively constant) and whatever raw page_visits retention the prune step enforces.
  • Percentile queries against the daily stats table will be cheap; the expensive part remains raw visit volume and the prune window.

Failure modes

  • Silent aggregation failure: if the scheduled command fails (DB error, unsupported SQL), stats simply stay null — no alarm fires unless something is watching. Add a monitor on "yesterday's row has non-null response_time_stats," not just on command exit code.
  • Unsupported DB engine: percentile SQL errors out at runtime, discovered only when a day fails to aggregate. Verify in staging with the production engine before rollout.
  • Migration lock/timeout: a long DDL operation on a busy table could cause deploy timeout and a partial rollout. Test on a production-sized copy.
  • Metric misinterpretation: stakeholders treat p95 as user-perceived latency and set targets against it. Mitigate with a definition doc and an explicit "server-side only" caveat.
  • Retention/aggregation ordering: if pruning outpaces aggregation, days can permanently lose timing data. Confirm ordering guarantees in the package.

Ramp-up

  • Engineering: under a day to upgrade and validate (plus staging migration test). Reporting work is the real estimate — 2–5 days for a dashboard with correct null handling and comparisons.
  • Stakeholder ramp-up: one short briefing on metric scope and the "history starts at upgrade" limitation.
  • Recommend a 2–3 week observation period before the metric is used in any commitment, given the absence of historical baseline and the open questions on capture scope and percentile accuracy.
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.
gmostafa/php-graphql-client
xeviant/paystack
snowsoft/faker
meditationsteps/blogetc
animalyoung/laravel-influxdb
onix-solutions/sms-telera
lonely-lights/prosetta
oxygen/data
oxygen/core
jengo/base
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin
artisan-build/community-prompts
vleroy/smart
ayles-software/laravel-australian-public-holidays
cboxdk/laravel-id-spatie
cboxdk/laravel-id-billing
cboxdk/laravel-id-billing-bridge
simple-as-fuck/php-performance-log