Download the PHP package 16hands/filament-dynamic-filter without Composer

On this page you can find all versions of the php package 16hands/filament-dynamic-filter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package filament-dynamic-filter

Filament Dynamic Filter

Latest Version on Packagist Total Downloads

Dynamic select filters for Filament tables. For direct columns, options come from the current table query; relationship filters query the related model by default.

The Problem

If you've used DataTables before, you'll remember the column header filters that automatically populated with values from the table data. Filament's built-in SelectFilter requires you to manually define options or query them separately from an entire table/model.

This becomes a real pain with relationship managers. Say you have an Order resource with a LineItems relation manager. You want to filter line items by product name, but only show products that actually exist in this order's line items — not every product in the database.

This package gives you filters that pull their options from the current table query for direct columns, respecting any existing filters or scopes already applied. Relationship filters default to querying the related model directly, but you can override this with optionsQuery when you need custom constraints.

Installation

Usage

Multiple Selection

Lazy Option Loading (Searchable Only)

When lazy: true and searchable: true, options are empty until the user types. Search results are fetched on demand.

Large lists (recommended):

Short lists (preload is fine):

Relationship Filters

For filtering through relationships using whereHas:

By default, relationship filters query the related model directly (no joins) so options and search work out of the box. You can override this with optionsQuery if you need custom constraints:

Panel Access Control

Restrict filters to specific panels:

How It Works

The filter grabs the current table query (with all existing filters/scopes applied), plucks distinct values for the specified column when possible, and uses those as select options. Results are cached per column with a configurable TTL and scope.

Handles Carbon dates and PHP enums automatically — dates display as d/m/Y but filter as Y-m-d, enums use their getLabel() method for display.

Parameters

DynamicFilter::make() and DynamicFilter::multiple()

Parameter Type Description
name string Filter name (must be unique)
column string Dot-notation path to pluck from results (e.g. relation.field)
queryColumn string Database column for the where clause (e.g. table.field)
placeholder ?string Select placeholder text
label ?string Filter label
searchable bool Enable search in select (default: false)
lazy bool Defer options until search (requires searchable; default: false)
panels ?array Restrict to specific panel IDs
optionsMap ?array Map of raw values to display labels
formatOption ?callable Formatter callback: fn ($value): array|string|null
optionsQuery ?callable Provide a custom options Builder or Collection: fn (HasTable $livewire, Builder $query) (distinct/limit apply to Builders)

DynamicFilter::relationship() adds:

Parameter Type Description
relationship string Relationship name for whereHas
relationshipColumn string Column within the relationship
multiple bool Allow multiple selection (default: false)

It also supports all base parameters above (including optionsQuery).

Configuration

Publish the config if you'd like to tune caching:

When using tenant scope, provide a tenant key or resolver in your config (otherwise caching is skipped for safety):

Caching Notes

Requirements

License

MIT

Credits

16Hands


All versions of filament-dynamic-filter with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
filament/tables Version ^4.0|^5.0
spatie/laravel-package-tools Version ^1.16
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package 16hands/filament-dynamic-filter contains the following files

Loading the files please wait ...