spatie/laravel-stats
Lightweight Laravel package to track and summarize database stat changes over time. Create a stats class, call increase/decrease on events, then query totals and deltas over ranges grouped by day/week/month for easy reporting.
StatsWriter to support tenant-aware metrics (e.g., per-tenant subscription counts).set() method.Adopt if:
Look elsewhere if:
*"This package lets us track critical business metrics (e.g., subscriptions, revenue, user activity) with minimal engineering effort. Instead of spending weeks building a custom analytics system, we can:
Ask: "Which metrics would give us the most insight if we could track them in real time?"
*"This is a drop-in solution for tracking incremental/decremental metrics in Laravel. Key benefits:
BaseStats and call increase()/decrease() in your business logic.SubscriptionStats::query()->groupByWeek()->get()).StatsWriter::for(MyModel::class)).StatsWriter::for($tenant->orders)).increase(1, $pastDate) for backfilling).Trade-offs:
increase() in subscription controllers).Proposal:
StatsService facade to centralize metric calls (e.g., Stats::track('subscriptions')).Ask: "Which metrics should we prioritize for the MVP, and where should we hook into existing code?""*
How can I help you explore Laravel packages today?