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:
filament/widgets). Aligns with Filament’s modular design, allowing for easy extension or customization of stat widgets.flowframe/laravel-trend (now inlined), providing out-of-the-box period-over-period comparisons (e.g., daily/weekly/monthly trends). Reduces reliance on third-party analytics tools for basic metrics.Cons:
flowframe/laravel-trend is inlined).count, sum). Complex joins or subqueries may require custom query building.SimpleStat adapter.last30Days()->dailySum()) could impact dashboard load times if not optimized (e.g., caching, database indexing).where clauses could expose SQL injection risks if not sanitized (though Eloquent mitigates this).SimpleStat.use Spatie\FilamentSimpleStats\SimpleStat;
class UserStatsWidget extends Widget {
protected function getStats(): array {
return [
SimpleStat::make(User::class)
->last7Days()
->dailyCount()
->invertTrendColors(), // If fewer users is "better"
];
}
}
SimpleStat one by one.Cache::remember) for frequently accessed stats.created_at fields).filament/widgets, so it works with Filament’s widget groups, layouts, and permissions.canAccess, header, columns).SimpleStat::make(fn () => DB::table('orders')->selectRaw('sum(amount) as total'))
->last30Days()
->dailySum('total');
flowframe/laravel-trend, so no additional setup is needed beyond the package installation.composer require spatie/filament-simple-stats
php artisan vendor:publish --tag=filament-widgets
Widget and implement getStats().app/Filament/Widgets/UserStatsWidget.php
filament, laravel-trend) provide peer support.How can I help you explore Laravel packages today?