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 counts and sums with ready-made Stat widgets powered by Flowframe/laravel-trend, including last 30 days trends (daily/weekly) for models and fields.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Pros:

    • Laravel 13 Support: Now officially compatible with Laravel 13, aligning with the latest LTS release and reducing version drift risks.
    • Inlined laravel-trend: Eliminates external dependency on flowframe/laravel-trend (~100KB reduction), simplifying maintenance and reducing transitive dependency risks.
    • Filament v3+ Readiness: Implicitly signals compatibility with newer Filament versions (v3+), though explicit testing is still recommended.
    • Trend-Based Stats: Retains seamless integration with Filament’s widget system, preserving the original architectural benefits.
  • Cons:

    • Filament Dependency: Still tightly coupled with Filament v2/v3+, limiting portability to other admin panels.
    • Inlined Dependency Tradeoff: While laravel-trend is now bundled, customizations to trend logic (e.g., advanced aggregations) may require deeper forks.
    • Limited Customization Hooks: Opinionated design remains unchanged; non-standard visualizations still require overrides.

Integration Feasibility

  • Simplified Dependency Graph: Inlining laravel-trend reduces composer complexity and eliminates version conflicts with other packages using the same dependency.
  • Laravel 13 Compatibility: Native support for Laravel 13’s features (e.g., improved dependency injection, model observers) may enable cleaner widget implementations.
  • Database Agnostic: Continues to work with any Laravel-supported database, though trend queries may still benefit from database-specific optimizations (e.g., PostgreSQL’s date_trunc).

Technical Risk

  • Breaking Changes:
    • Laravel 13 Migration: Projects on Laravel 12 or below will need to upgrade, which may introduce risks (e.g., deprecated features, configuration changes). Test thoroughly.
    • Inlined laravel-trend: Internal API changes to the bundled trend logic could break custom implementations relying on flowframe/laravel-trend’s public methods.
  • Performance at Scale:
    • Bundled laravel-trend may introduce subtle query optimizations or regressions. Profile trend queries post-upgrade.
    • Caching behavior unchanged; ensure widget TTLs are still appropriate for high-traffic dashboards.
  • Testing Gaps:
    • Limited testing on Filament v3+; monitor for widget API changes (e.g., registration methods, caching hooks).
    • No explicit tests for Laravel 13’s new features (e.g., model events, first-party testing tools).

Key Questions

  1. Laravel Version: Is the project on Laravel 12 or below? If so, what’s the upgrade path and risk tolerance for breaking changes?
  2. Custom Trend Logic: Does the app extend laravel-trend beyond default usage (e.g., custom aggregations)? If yes, test thoroughly after inlining.
  3. Filament Version: Is the project using Filament v3+? If not, verify widget compatibility (e.g., registerWidgets() method changes).
  4. CI/CD Pipeline: How will Laravel 13 and Filament v3+ upgrades be tested in staging? Are there known issues with the new release?
  5. Data Volume: With laravel-trend inlined, are there opportunities to optimize trend queries further (e.g., database-specific functions)?

Integration Approach

Stack Fit

  • Primary Fit:
    • Laravel 13+ with Filament v2/v3. Ideal for projects adopting the latest Laravel LTS or planning upgrades.
    • SaaS/Analytics Platforms: Teams using Filament for admin panels and requiring time-series stats.
  • Secondary Fit:
    • Projects using laravel-trend who want to simplify dependencies.
    • Teams prioritizing rapid dashboard development over custom UI.
  • Non-Fit:
    • Non-Filament Laravel apps (e.g., API-only, Livewire-only).
    • Projects requiring real-time stats or non-standard trend visualizations.

Migration Path

  1. Prerequisites:
    • Upgrade Laravel to 13.x (if not already):
      composer require laravel/framework:^13.0
      
    • Update Filament to v3.x (if using v2):
      composer require filament/filament:"^3.0"
      
    • Update the package:
      composer require spatie/filament-simple-stats:"^1.2"
      
  2. Implementation:
    • Widget Registration: Unchanged (Filament’s registerWidgets() remains stable):
      public function panel(Panel $panel): Panel
      {
          return $panel->widgets([
              Total::make('Users', User::query()->count()),
              Trend::make('Users', User::query()->trend('count', 'daily')),
          ]);
      }
      
    • Data Layer: Ensure Eloquent models are compatible with Laravel 13 (e.g., model observers, events).
    • Testing: Validate trend queries and caching with Laravel 13’s testing tools (e.g., assertDatabaseHas).
  3. Post-Upgrade Checks:
    • Remove flowframe/laravel-trend from composer.json (now bundled).
    • Test custom trend logic if extended beyond defaults.

Compatibility

  • Laravel: Officially supports 13.x; test on 12.x if downgrading is needed (may require forks).
  • PHP: Still requires 8.1+ (no change).
  • Filament: Compatible with v2/v3; test v3-specific features (e.g., new widget APIs).
  • Database: No active changes, but leverage Laravel 13’s query builder improvements (e.g., whereBetween syntax).

Sequencing

  1. Phase 1: Upgrade Laravel to 13 and Filament to v3 in a staging environment.
  2. Phase 2: Update filament-simple-stats to 1.2.0 and test basic widgets.
  3. Phase 3: Validate custom trend logic and performance.
  4. Phase 4: Deploy to production with monitoring for query regressions.

Operational Impact

Maintenance

  • Pros:
    • Simplified Dependencies: Inlined laravel-trend reduces composer updates and conflict risks.
    • Laravel 13 Alignment: Future-proofs the stack with the latest LTS release.
    • Active Maintenance: Spatie’s recent contributions (e.g., Laravel 13 support) indicate ongoing development.
  • Cons:
    • Upgrade Risk: Laravel 13 and Filament v3 may introduce breaking changes (e.g., configuration, middleware).
    • Bundled Code: Customizations to laravel-trend now require patching the vendor codebase (risk of merge conflicts).
    • Documentation Lag: Limited examples for Laravel 13/Filament v3-specific features.

Support

  • Documentation:
  • Debugging:
    • Use vendor:publish to inspect bundled laravel-trend config if customizations are needed.
    • Leverage Laravel 13’s improved error pages for stack traces.
  • Vendor Support: Spatie’s paid support now covers Laravel 13/Filament v3 issues.

Scaling

  • Performance:
    • Bundled laravel-trend: May include optimizations for Laravel 13 (e.g., improved query caching). Profile post-upgrade.
    • Caching: Unchanged; ensure Redis or database caching is configured for high-traffic dashboards.
    • Query Optimization: Add indexes to created_at/updated_at columns used in trend queries.
  • Horizontal Scaling: Stateless widgets scale with Filament’s caching; use shared Redis for distributed setups.
  • Load Testing: Simulate concurrent dashboard loads to validate query performance under Laravel 13.

Failure Modes

Failure Point Impact Mitigation
Laravel 13 breaking changes Widget/dependency failures Test in staging; use up command for safe upgrades.
Inlined laravel-trend bugs Incorrect trend calculations Fork the package if critical fixes are needed.
Filament v3 API changes Widget registration failures Review Filament’s v3 migration guide.
Database query regressions Slow dashboard load Profile with Laravel 13’s DB::enableQueryLog().
Caching misconfiguration Stale data Use cache()->forever() for critical stats.

Ramp-Up

  • Developer Onboarding:
    • Time: 1–2 hours for Laravel 13/Filament v3 upgrades;
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport