Weave 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 Date Scopes Filter Laravel Package

aymanalhattami/filament-date-scopes-filter

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Pros:

    • Filament Integration: Seamlessly integrates with Filament v3/v4/v5, aligning with modern Laravel admin panel architectures. Leverages Filament’s table filter system, reducing custom UI/UX development.
    • Date-Scope Abstraction: Builds on laravel-date-scopes, a battle-tested package for date-based query filtering. This ensures consistency with Laravel’s Eloquent query builder.
    • Granular Configuration: Supports fine-grained control over date scopes (e.g., exclude seconds, decades, etc.), making it adaptable to diverse use cases (e.g., financial reports vs. real-time logs).
    • Multi-Language Support: Localization-ready (Arabic included), useful for global applications.
    • Indicators & UX: Visual feedback (e.g., active scope indicators) improves user experience without additional effort.
  • Cons:

    • Dependency on laravel-date-scopes: Requires models to be pre-configured with date scopes (e.g., HasDateScopes trait). This adds a pre-integration step for models not already using this package.
    • Limited Customization: UI/UX is opinionated (e.g., dropdown-based selector). Custom styling may require overriding Filament’s Blade components.
    • No Server-Side Pagination Optimization: Date scopes apply filters at the query level, but complex scopes (e.g., decades) could impact performance if not indexed properly.

Integration Feasibility

  • Filament Version Support:
    • Officially supports Filament v3–v5 (as of v2.0.2). If using an older version, compatibility may require backporting or forking.
    • PHP 8.4/8.5 support ensures alignment with modern Laravel LTS (10.x/11.x).
  • Database Compatibility:
    • Works with any database supporting DATE, DATETIME, or TIMESTAMP columns (MySQL, PostgreSQL, SQLite, etc.).
    • Indexing Requirement: Performance-critical tables should have indexes on filtered date columns (e.g., created_at).
  • Existing Codebase Impact:
    • Low Risk: Non-intrusive if models already use laravel-date-scopes. Otherwise, requires adding the trait to models.
    • Filament Tables: Only requires adding the filter to table() definitions in Filament resources/pages.

Technical Risk

Risk Area Assessment Mitigation Strategy
Dependency Bloat Adds laravel-date-scopes as a transitive dependency (~50KB). Acceptable for most projects; minimal overhead.
Query Performance Complex scopes (e.g., decades) may generate slow queries without indexes. Profile queries with DB::enableQueryLog(); add indexes to date columns.
Filament Version Lock Tied to Filament’s release cycle. Monitor Filament updates; test package compatibility early.
Localization Gaps Only Arabic translations provided out-of-the-box. Extend translations via vendor:publish or community contributions.
Customization Limits UI is not fully themeable without overriding Filament components. Use Filament’s modify methods or CSS to adapt appearance.

Key Questions

  1. Model Readiness:
    • Are target models already using laravel-date-scopes? If not, what’s the effort to migrate them?
  2. Performance Requirements:
    • Will tables have >100K rows? If so, are date columns indexed?
  3. Filament Version:
    • Is the project using Filament v3/v4/v5? If not, what’s the upgrade path?
  4. Localization Needs:
    • Are non-English languages required? If so, are additional translations needed?
  5. Customization Needs:
    • Is the default UI sufficient, or will styling/UX overrides be required?
  6. Testing Coverage:
    • Are there edge cases (e.g., null dates, timezone handling) that need validation?

Integration Approach

Stack Fit

  • Primary Use Case:
    • Ideal for Filament-based admin panels where users need to filter records by date ranges (e.g., analytics dashboards, CRM systems, inventory management).
  • Tech Stack Alignment:
    • Laravel 10/11: Compatible with PHP 8.4/8.5 and modern Laravel features.
    • Filament v3–v5: Native integration reduces boilerplate.
    • Eloquent Models: Requires laravel-date-scopes trait (minimal overhead).
  • Alternatives Considered:
    • Custom Filament Filters: More flexible but requires ~50–100 LOC per scope.
    • Third-Party Packages: Few alternatives offer the same granularity (e.g., spatie/laravel-filament-tables lacks date-scopes).
    • Verdict: This package offers the best balance of functionality and maintainability.

Migration Path

  1. Prerequisite Setup:
    • Install laravel-date-scopes and configure models:
      composer require laracraft/laravel-date-scopes
      
      Add HasDateScopes trait to models:
      use Laracraft\DateScopes\HasDateScopes;
      class Order extends Model { use HasDateScopes; }
      
  2. Package Installation:
    composer require aymanalhattami/filament-date-scopes-filter
    
  3. Filament Integration:
    • Add the filter to a resource’s table() method:
      use AymanAlhattami\FilamentDateScopesFilter\DateScopeFilter;
      
      public static function table(Table $table): Table {
          return $table->filters([
              DateScopeFilter::make('created_at'),
          ]);
      }
      
  4. Optional Customization:
    • Publish translations:
      php artisan vendor:publish --tag="filament-date-scopes-filter-translations"
      
    • Exclude scopes:
      DateScopeFilter::make('created_at')->withoutDecades()->withoutCenturies()
      

Compatibility

Component Compatibility Status Notes
Filament v3 ✅ Supported Tested in changelog (v2.0.0).
Filament v4 ✅ Supported Explicitly added in PR #16.
Filament v5 ✅ Supported (v2.0.1+) Requires v2.0.1+ for full compatibility.
PHP 8.1–8.3 ⚠️ May work Not officially tested; use at own risk.
PHP 8.4/8.5 ✅ Supported Confirmed in v2.0.1.
MySQL/PostgreSQL ✅ Supported Standard SQL date functions used.
SQLite ✅ Supported No database-specific logic.
Custom Date Columns ✅ Supported (with trait) Any column with DATE/DATETIME type works if model uses HasDateScopes.

Sequencing

  1. Phase 1: Proof of Concept (1–2 days)
    • Install package and test on a non-critical Filament table.
    • Validate date scopes work as expected (e.g., "Last 7 Days" filter).
  2. Phase 2: Model Migration (1–3 days)
    • Add HasDateScopes to target models (if not already present).
    • Test edge cases (e.g., null dates, timezone offsets).
  3. Phase 3: Integration (1 day)
    • Add filters to Filament resources/pages.
    • Customize appearance/translations if needed.
  4. Phase 4: Performance Tuning (1–2 days)
    • Profile queries with DB::enableQueryLog().
    • Add indexes to date columns if queries are slow.
  5. Phase 5: Rollout
    • Deploy to staging/production.
    • Monitor for query timeouts or unexpected behavior.

Operational Impact

Maintenance

  • Pros:
    • Minimal Ongoing Work: No need to update logic if Filament or Laravel versions are patched (backward-compatible).
    • Community Support: MIT-licensed with active maintenance (last release: 2026-05-25).
    • Isolated Scope: Changes to the package unlikely to break other Filament features.
  • Cons:
    • Dependency Updates: Requires monitoring laravel-date-scopes and Filament for breaking changes.
    • Customizations: Overrides (e.g., translations, UI tweaks) must be maintained manually.

Support

  • Troubleshooting:
    • **
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.
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin
artisan-build/community-prompts
vleroy/smart
ayles-software/laravel-australian-public-holidays
cboxdk/laravel-id-spatie
cboxdk/laravel-id-billing
cboxdk/laravel-id-billing-bridge
simple-as-fuck/php-performance-log
hsluv/hsluv
seampact/codegen
seampact/hooks
seampact/ir
mehedimi/laravel-amp-mail
happones/laravel-vue-i18n-generator
jwerd/inertia-table
siberfx/flysystem-wasabi
hollyit/token-replace
ippanelcom/laravel-sdk