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 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

Product Decisions This Supports

  • Build vs. Buy for Analytics Dashboards:

    • Use Case: Rapidly deploy data-driven dashboards (e.g., SaaS metrics, CRM analytics, or internal tools) without reinventing stat visualization wheels. Avoids custom development for common metrics like daily active users (DAU), revenue trends, or error rates.
    • Trade-off: Sacrifices full customization for speed; ideal for MVP phases or internal tools where consistency > uniqueness.
    • Example: A PM for a subscription-based platform could integrate this to showcase churn/revenue stats in <1 hour vs. weeks of frontend/backend dev work.
  • Roadmap Prioritization:

    • Quick Wins: Deliver high-impact metrics (e.g., "Users this month: +12%") to stakeholders without blocking on design or complex queries.
    • Iterative Refinement: Start with prebuilt widgets, then layer custom queries (via where()) or styling as needed. Example: Begin with SimpleStat::make(User::class)->last30Days()->dailyCount(), then add filters (e.g., where('plan', 'premium')) later.
    • A/B Testing: Deploy multiple dashboard variants (e.g., with/without trends) to test user engagement before investing in custom builds.
  • Feature Flagging Strategy:

    • Toggle-Based Rollout: Use Filament’s widget visibility flags to A/B test stat widgets across user segments (e.g., show trends only to power users).
    • Progressive Enhancement: Start with basic counts (dailyCount()), then enable trends (withoutTrend() → enabled) as data maturity improves.
  • Cross-Team Collaboration:

    • PM-Dev Handoff: Reduces friction between PMs and devs by providing a standardized interface for metrics. PMs can define requirements in plain PHP (e.g., "Show error rates with inverted trends"), while devs focus on integration.
    • Data Team Alignment: Ensures consistency with backend data models (e.g., Eloquent queries) and avoids ad-hoc SQL or API calls.

When to Consider This Package

  • Adopt When:

    • Your product relies on repetitive stat visualizations (e.g., "X metric over time" across multiple dashboards).
    • You’re using Filament (Laravel admin panel) and need to add analytics without heavy frontend work.
    • Your team lacks dedicated dashboard designers or has tight deadlines for metric-heavy features.
    • You need trend analysis (e.g., % change vs. prior period) with minimal code.
    • Your data lives in Eloquent models (supports custom queries via where()).
  • Look Elsewhere If:

    • You require highly custom visualizations (e.g., complex charts, real-time streaming). Use libraries like laravel-charts or Chart.js instead.
    • Your metrics depend on non-Eloquent data sources (e.g., external APIs, raw SQL views). This package is Eloquent-centric.
    • You need sub-second latency for global-scale dashboards. This package adds query overhead for trend calculations.
    • Your design system rejects the default styling. The widgets are opinionated (e.g., green/red trends).
    • You’re building a public-facing consumer app where brand consistency demands custom UI. This is better suited for internal tools or B2B SaaS.

How to Pitch It (Stakeholders)

For Executives:

"This package lets us ship data-driven dashboards 10x faster by reusing prebuilt, trend-aware stat widgets. For example, we can add a ‘Monthly Revenue’ widget to our admin panel in under an hour—no need to hire a designer or write custom queries. It’s like using LEGO blocks for analytics: plug in your Eloquent model (e.g., User, Order), pick a metric (count, sum, avg), and instantly get a professional-looking stat with trend arrows. Perfect for tracking KPIs like churn, DAU, or support tickets without dev bottlenecks."

ROI:

  • Speed: Reduces dashboard dev time from weeks to hours.
  • Consistency: Ensures all teams use the same metric formatting (e.g., % changes, date ranges).
  • Scalability: Add new stats by editing a single PHP method—no frontend work.

Risk Mitigation:

  • Start with 2–3 critical metrics (e.g., revenue, active users), then expand.
  • Use Filament’s widget visibility flags to A/B test impact before full rollout.

For Engineering:

*"This is a Filament-specific wrapper around flowframe/laravel-trend that gives us prebuilt stat widgets with zero UI boilerplate. Key benefits:

  • No JavaScript: Stats render server-side with Laravel/Eloquent.
  • Trend Analysis Out of the Box: Automatically calculates % changes vs. prior periods (configurable for ‘good’ vs. ‘bad’ trends, e.g., inverted colors for error rates).
  • Query Flexibility: Chain where(), last30Days(), dailySum(), etc., to tailor to any Eloquent model.
  • Filament Native: Integrates seamlessly with Filament’s widget system—no styling conflicts.

Example Use Case:

// Add this to a Filament Widget class to show:
protected function getStats(): array {
    return [
        SimpleStat::make(Order::class)
            ->last7Days()
            ->dailySum('amount')
            ->description('Revenue'),
        SimpleStat::make(SupportTicket::class)
            ->last30Days()
            ->dailyCount()
            ->invertTrendColors() // Green = fewer tickets (good!)
            ->description('Tickets Resolved'),
    ];
}

Trade-offs:

  • Tight coupling to Filament/Eloquent.
  • Limited customization for non-standard visualizations.
  • Trend calculations add minor query overhead.

Recommendation: Use for 80% of stat needs, then fall back to custom widgets for edge cases."*

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