Weave Code
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
Filament Simple Stats

Filament Simple Stats Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Opinionated prebuilt stat widgets to quickly add to your Filament dashboards.

Frequently asked questions about Filament Simple Stats
How do I add a simple count stat for users in the last 30 days to my Filament dashboard?
Use `SimpleStat::make(User::class)->last30Days()->dailyCount()` in your widget’s `getStats()` method. This generates a prebuilt stat card with a trend chart for daily user counts over the last 30 days. No additional setup is needed beyond requiring the package.
Does this package work with Laravel 11 or older versions?
The package officially supports Laravel 12/13. For Laravel 11 or older, you’ll need to manually adjust dependencies (e.g., downgrade `filament/widgets` to v4) or use a forked version. Check the GitHub issues for community patches.
Can I customize the time range for stats beyond 'last30Days'?
Yes, you can chain methods like `last7Days()`, `lastYear()`, or `between($startDate, $endDate)` to any stat. For custom ranges, use `between()` with Carbon instances or `customRange()` for full flexibility.
How do I filter stats by a specific condition, like completed orders?
Use Eloquent query methods like `where()` directly on the stat. For example: `SimpleStat::make(Order::class)->where('status', 'completed')->last7Days()->dailySum('amount')`. This filters the underlying query before aggregation.
Will these stats impact my dashboard performance if I have millions of records?
For large datasets, enable Laravel’s query caching (e.g., `Cache::remember()`) or optimize your database with indexes on filtered columns. The package itself doesn’t cache, but you can wrap `getStats()` in a cached closure or use materialized views for critical metrics.
Can I use this package with non-Filament dashboards or other admin panels?
No, this package is designed specifically for Filament widgets. For other admin panels, you’d need to rebuild the stat logic manually or create a wrapper. The core trend functionality (via `laravel-trend`) could be reused, though.
How do I disable the trend chart for a specific stat?
Call `withoutTrend()` on the stat builder. For example: `SimpleStat::make(Model::class)->last30Days()->dailyCount()->withoutTrend()`. This will show only the raw value without the comparison chart.
Are there alternatives if I need more complex aggregations like averages or custom SQL?
For advanced aggregations, consider `laravel-trend` directly or packages like `spatie/laravel-analytics`. This package focuses on counts/sums with trends, but you can extend it by overriding the query builder or using raw SQL via `selectRaw()`.
How do I test my Filament widgets with these stats in a CI pipeline?
Mock the `getStats()` method in your widget tests using Laravel’s testing helpers. For example: `Widget::fake()->withStats([...])`. Ensure your test database has sample records to avoid null queries. The package itself is well-tested via GitHub Actions.
Can I invert the trend colors for metrics where decreases are positive (e.g., error rates)?
Yes, use `invertTrendColors()` on the stat builder. For example: `SimpleStat::make(ErrorLog::class)->last30Days()->dailyCount()->invertTrendColors()`. This flips the color logic to highlight reductions as improvements.
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.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai