spatie/laravel-stats
Lightweight Laravel package that summarizes database changes over time. Define a stats class, call increase() or decrease() as events happen, then query totals grouped by day, week, or month, returning increments, decrements, and net differences for each period.
Architecture fit
BaseStats, StatsWriter, StatsQuery, and HasStats abstractions are Laravel-native and align with Eloquent models, relationships, multi-tenant patterns, and custom attributes.Integration feasibility
BaseStats subclass, call increase/decrease/set, and query with StatsQuery.HasStats, model/class/relationship writers, custom attribute filters, and group-by minute/hour/day/week/month/year.Technical risk
increase/decrease/set. Missing calls, failed listeners, retries, or duplicated domain events can permanently skew counts unless wrappers, idempotency, and reconciliation are designed.set, increase, and decrease need clear operational semantics, especially when mixing fixed-value snapshots with change events. Teams must understand how value, increments, decrements, and difference are computed to avoid double counting.Key questions
Stack fit
increase/decrease calls throughout controllers and models. The wrapper should own stat naming, metadata, timestamp handling, idempotency strategy, and failure behavior.StatsWriter::for() with models, relationships, or custom attributes rather than creating many near-duplicate BaseStats classes.Migration path
increase/decrease or set semantics match the desired metric.Compatibility
Sequencing
Maintenance
Support
Scaling
Failure modes
set versus increase/decrease semantics.Ramp-up
How can I help you explore Laravel packages today?