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 stat widgets to my Filament dashboard using spatie/filament-simple-stats?
Extend a Filament widget class and override `getStats()` to return an array of `SimpleStat` instances. For example, use `SimpleStat::make(User::class)->last7Days()->dailyCount()` to display daily user counts. The package handles the UI rendering automatically.
Which Laravel and Filament versions does this package support?
The package is optimized for **Laravel 12–13** and **Filament 5.2+**. Ensure your project meets these requirements before installation. Downgrading Filament may break compatibility.
Can I customize the queries for my stats (e.g., add WHERE clauses or joins)?
Yes, use the `where()` method on `SimpleStat` to modify queries. For example, `SimpleStat::make(Order::class)->where('status', 'completed')->dailySum('amount')` filters results before aggregation.
Does this package support non-Eloquent data sources (e.g., API calls or raw arrays)?
No, it’s designed for Eloquent models. For non-database data, you’d need to create a custom query builder or adapter, though the package doesn’t provide built-in support for this.
How do I change the time period for trend comparisons (e.g., year-over-year instead of period-over-period)?
The package defaults to period-over-period comparisons (e.g., last 7 days vs. previous 7 days). For custom logic, extend the `SimpleStat` class or use `invertTrendColors()` to tweak visuals, but overriding the core trend calculation requires custom code.
Will these stat widgets impact performance on high-traffic dashboards?
The package uses efficient SQL queries (e.g., `GROUP BY` with window functions) via `laravel-trend`. However, rendering many stats on a single dashboard could slow down page loads. Cache results using Filament’s `cacheFor()` or Laravel’s `remember()` for improvement.
Can I use spatie/filament-simple-stats with Filament Nova or Backpack instead of Filament?
No, this package is **Filament-specific** and won’t work with Nova or Backpack. The widgets are tightly integrated with Filament’s widget system and Blade/React components.
How do I style or customize the appearance of the stat cards?
The package uses Filament’s default styling for consistency. To customize, override Filament’s widget classes or use CSS to target the generated HTML classes (e.g., `.filament-widgets-stats`). Avoid inline styles for maintainability.
Are there alternatives to this package for Filament stats?
Yes, consider **Filament’s built-in Stat Widgets** for basic needs or **custom widgets** using Filament’s `Widget` class. For advanced trends, explore `flowframe/laravel-trend` directly or packages like `spatie/laravel-analytics`.
How do I handle edge cases like empty datasets or null values in my stats?
The package includes basic null checks, but validate your data models. For empty datasets, ensure your queries return zero or a fallback value. Test with edge cases like deleted records or incomplete time series.
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.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony