spatie/filament-simple-stats
Opinionated, prebuilt stat widgets for Filament dashboards. Quickly add daily counts and sums using Flowframe/laravel-trend, with helpers like last 30 days to generate clean, consistent stats cards with minimal setup.
Pros:
flowframe/laravel-trend (now inlined), providing period-over-period comparisons without additional dependencies. Reduces complexity for time-series metrics.dailyCount(), dailySum()) and UI rendering, adhering to Laravel’s Eloquent patterns. Ideal for teams prioritizing rapid iteration over customization.where() clauses) and custom trend logic (e.g., invertTrendColors()), balancing flexibility with convention.Cons:
laravel-trend uses efficient SQL queries (e.g., GROUP BY with window functions). Risk of performance degradation if stats are overused on high-traffic dashboards.laravel-trend reduces external dependencies but increases package size slightly (~1MB).cacheFor or Laravel’s remember)?SimpleStat::custom() if exposed).composer require spatie/filament-simple-stats
StatsOverview) and override getStats():
protected function getStats(): array {
return [
SimpleStat::make(User::class)->last7Days()->dailyCount(),
SimpleStat::make(Order::class)->last30Days()->dailySum('amount'),
];
}
app/Providers/Filament/AdminPanelProvider.php.where clauses.withoutTrend(), invertTrendColors()). Complex cases may need extending the package.where() clauses) and trends for business-specific metrics.cacheFor(3600) in widgets).user_id).LAG()). Test with production-like data volumes.try-catch or default fallbacks:
SimpleStat::make(Order::class)->dailySum('amount')->default(0);
How can I help you explore Laravel packages today?