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 Header Filters Laravel Package

leek/filament-header-filters

Add inline filters to Filament table column headers. Attach any BaseFilter (selects, date pickers, min/max ranges, custom schemas) as a richer alternative to individual searchable fields. Works with Filament v4/v5, PHP 8.2+.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Filament-Centric Design: The package leverages Filament’s existing BaseFilter and InteractsWithTable abstractions, ensuring seamless integration with Filament’s table system (v4/v5). The HasHeaderFilters trait and view overrides (filament-tables::index) demonstrate a low-friction extension point for Filament’s core functionality.
  • Macro-Based API: Column-level headerFilter() and filter-level columnName() macros provide a declarative, column-specific approach, aligning with Filament’s pattern of attaching behaviors to table components. This avoids global state pollution and keeps filters scoped to their columns.
  • State Sharing: Explicitly designed to share state with panel filters (via $tableFilters), ensuring consistency in filter indicators, reset functionality, and session persistence. This reduces cognitive load for users familiar with Filament’s panel filters.
  • View Layer Isolation: The CSS and view override are self-contained, with minimal coupling to Filament’s internals. The package’s view patch is documented as a "last resort" fix, signaling a respect for Filament’s upgrade path (though it may require re-application after major Filament updates).

Integration Feasibility

  • Composer Dependency: Single composer require with no runtime conflicts (PHP 8.2+ and Filament v4/v5 are the only hard requirements). The package’s MIT license and active maintenance (last release: July 2026) reduce adoption risk.
  • Trait-Based Activation: The HasHeaderFilters trait requires minimal boilerplate (one use statement per Livewire component). This is lower overhead than event listeners or service providers for enabling header filters.
  • CSS Integration: Requires one Vite import and asset rebuild (npm run build). This is a standard Filament pattern (e.g., theme customization) and doesn’t introduce build complexity.
  • Filter Compatibility: Supports any BaseFilter subclass, including Filament’s built-in filters (SelectFilter, DatePicker) and custom schemas. This future-proofs the package against new Filament filter types.

Technical Risk

  • Filament Version Lock: Hard dependency on Filament v4/v5. Upgrades to Filament v6+ may require package updates or manual patches (e.g., the view override). Mitigation: Monitor Filament’s roadmap and the package’s issue tracker for compatibility announcements.
  • Asset Build Dependency: Vite/NPM required for CSS integration. Teams using Laravel Mix or no frontend build tools will need to adopt Vite or manually include the CSS. Mitigation: Document this as a one-time setup cost in migration plans.
  • State Normalization Edge Cases: While v2.0.4 fixes stale state for single-select filters, complex multi-select transitions (e.g., rapid toggling between single/multi-select modes) may still surface issues. Mitigation: Test with real-world filter workflows (e.g., "filter by status → clear → filter by date").
  • Styling Conflicts: Opinionated CSS (e.g., dropdown z-index, cell sizing) may clash with custom Filament themes. Mitigation: Provide override hooks in documentation (e.g., !important overrides or BEM classes for targeting).
  • Hidden Columns: Filters on hidden columns are automatically skipped, which may surprise developers expecting all filters to apply. Mitigation: Clarify this behavior in internal conventions (e.g., "Header filters on hidden columns are no-ops").

Key Questions

  1. Filament Version Strategy:
    • Is the team planning to upgrade Filament beyond v5? If yes, how will we track compatibility with this package?
    • Action: Add a quarterly check for Filament v6+ compatibility in the package’s issue tracker.
  2. Build Tooling:
    • Does the team use Vite/NPM, or will we need to adopt it for this package? If not, can we manually include the CSS as a fallback?
    • Action: Audit build tools and document the CSS fallback path (e.g., inline <style> tag).
  3. Filter Complexity:
    • Are there custom BaseFilter subclasses in use that might not work with headerFilter()? If so, which ones?
    • Action: Test with all custom filters pre-deployment.
  4. State Management:
    • Are there critical workflows relying on rapid single/multi-select transitions (e.g., "filter by A → filter by B → clear")?
    • Action: Test with edge-case filter sequences to validate v2.0.4’s fixes.
  5. Theming:
    • Does the team have custom Filament themes that might conflict with the package’s CSS?
    • Action: Review theme overrides and document CSS isolation strategies (e.g., scoped classes).
  6. Hidden Columns:
    • Are there use cases where filters on hidden columns should still apply (e.g., for analytics)?
    • Action: Clarify expectations in internal conventions or extend the package if needed.
  7. Performance:
    • Will tables with many header filters (e.g., 10+ columns) cause UI lag or memory issues?
    • Action: Benchmark with large tables (e.g., 50+ rows, 10+ filters) to validate scalability.

Integration Approach

Stack Fit

  • Filament v4/v5: Native support with zero architectural conflicts. The package’s trait and macro design aligns with Filament’s component-based architecture.
  • PHP 8.2+: No polyfills or compatibility layers required. Leverages modern PHP features (e.g., named arguments, attributes) implicitly.
  • Livewire: Relies on Livewire’s reactive state management for real-time filter updates. No custom JavaScript required.
  • Vite/NPM: Required for CSS integration but follows Filament’s standard theme customization pattern. No custom build plugins needed.
  • Database: Assumes Eloquent Builder queries for filtering. Complex SQL (e.g., raw queries, joins) must be handled within the BaseFilter::query() method.

Migration Path

  1. Dependency Addition:
    • Composer: composer require leek/filament-header-filters.
    • PHP: Add HasHeaderFilters trait to target Livewire components (e.g., ListRecords pages).
    • Risk: Low. Single command with no breaking changes.
  2. CSS Integration:
    • Update vite.config.js or resources/css/app.css to import the package’s stylesheet after Filament’s theme:
      @import 'filament/filament/resources/css/theme.css';
      @import 'leek/filament-header-filters/resources/css/filament-header-filters.css';
      
    • Rebuild assets: npm run build (or dev for local testing).
    • Risk: Medium. Requires build tool familiarity. Mitigate with documentation or a one-time workshop.
  3. Column Configuration:
    • Replace or augment existing searchable(isIndividual: true) with headerFilter(BaseFilter) on target columns.
    • Example:
      TextColumn::make('status')
          ->badge()
          ->headerFilter(
              SelectFilter::make('status')
                  ->options(OrderStatus::class)
          );
      
    • Risk: Low. Syntax is similar to existing Filament patterns.
  4. Panel Filters:
    • If using only header filters, hide the panel filters button:
      ->filtersLayout(FiltersLayout::Hidden)
      
    • Risk: Low. Optional optimization.
  5. Testing:
    • Validate:
      • Filter state persistence (session/indicators).
      • Real-time updates (no deferFilters() dependency).
      • Edge cases (hidden columns, rapid state changes).
    • Risk: Medium. Requires manual testing of critical workflows.

Compatibility

  • Filament Plugins: May conflict if they override table views or CSS. Mitigation: Test with all active Filament plugins pre-deployment.
  • Custom Filters: Custom BaseFilter subclasses should work but may need columnName() macro if not using Filament’s built-in filters. Mitigation: Document custom filter requirements.
  • Legacy Filament: Incompatible with Filament v3 or older. Mitigation: Block adoption if using older versions.
  • Frontend Frameworks: No conflicts with Alpine.js, Inertia.js, or Livewire components outside Filament tables.

Sequencing

  1. Pre-requisite: Ensure Filament v4/v5 and PHP 8.2+ are in place.
  2. Dependency: Install the package before configuring columns.
  3. CSS: Integrate styles before testing columns.
  4. Columns: Migrate filters one table/page at a time (e.g., start with high-impact resources like Orders or Users).
  5. Testing: Validate state, UX, and edge cases before
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.
besmartand-pro/php-quality-config
sentix/ai-chatbot
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity