Download the PHP package webdirect/ai-filters without Composer

On this page you can find all versions of the php package webdirect/ai-filters. 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 ai-filters

Webdirect AI Filters for Filament

Credits: the idea for this plugin came from this video on the Filament Daily channel by Povilas Korop. Huge thank-you — go subscribe.

A Filament v4 panel plugin that lets users filter any table with natural language. Click the AI Filter button on a table, type what you want ("active platinum customers from Germany signed up last year"), and the plugin sends your prompt plus the table's available filters to an AI model. The model responds with a structured set of filter values that the plugin applies to the table.

Powered by the official laravel/ai package, so any provider it supports (Anthropic, OpenAI, Gemini, ...) can be used.

Requirements

Package Version
PHP ^8.3
Laravel ^11 / ^12 / ^13
filament/filament ^4.0 / ^5.0
laravel/ai ^0.6 / ^1.0

Installation

1. Require the package

laravel/ai is pulled in automatically. The plugin's service provider is auto-discovered, no manual registration needed.

2. Publish the config

This creates config/ai-filters.php.

3. Configure your AI provider

The plugin uses whatever provider you configure in config/ai.php. The fastest path for Anthropic:

For OpenAI:

If you want to override the provider's API key from the plugin's own config, set AI_FILTERS_API_KEY instead — the plugin will rewrite ai.providers.<provider>.key at boot.

4. Register the plugin on a panel

Registering the plugin is optional today — the action works on its own — but doing so future-proofs you for panel-level configuration helpers.

Usage

Add AiFilterAction::make() to any Filament table's headerActions():

That's it. Open the table, click AI Filter, write what you want, hit Apply.

Supported filter types

The plugin is fully dynamic: it introspects each filter's form schema and sends the AI a rich description of every form field — its name, type, label, whether it's required, its Laravel validation rules, and (for Select/Radio) the accepted options.

This means any Filament filter works out of the box, including your own custom-schema filters. The built-in handling for the common ones:

Filter Fields exposed to AI
SelectFilter (single) value + option keys
SelectFilter with ->multiple() values (array) + option keys
TernaryFilter value + booleanLike: true
Filter (toggle / no schema) isActive (Checkbox / Toggle)
Filter with custom schema every form field: name, type, required, rules, options, inputType (email/number/url), inputFormat (date/datetime/time), placeholder

For custom-schema filters, the AI sees the field names you defined, so use descriptive keys like from, until, min_revenue, email_domain.

Global search

If the table has searchable columns and the user's request maps to free text (e.g. "find Amira"), the AI will fall back to setting the table's global search. Filters are preferred whenever a matching one exists.

Customising the action

AiFilterAction::make() returns a regular Filament Action, so you can chain on top of it:

Translations

The plugin ships with translations for the following locales:

en (default) · ro · es · fr · de · it · nl · pt_BR · pl · tr

Laravel automatically picks the right file based on the active locale (App::setLocale() / APP_LOCALE). If a locale is missing, Laravel falls back to the configured fallback locale (English by default).

Publishing translations — to customize the shipped strings:

This copies every locale to lang/vendor/ai-filters/<locale>/ai-filters.php. Edit whichever you need. Published files take precedence over the ones shipped in the package.

Overriding via config — for a table-specific label you can bypass translations entirely by setting the string in config/ai-filters.php:

Every null value falls back to the translated string; every string value wins over it.

Missing a language? PRs welcome — copy resources/lang/en/ai-filters.php, translate, open a pull request.

Customising the system prompt

The full system prompt that steers the AI lives in a Markdown file, not in PHP code. You can override it with your own file without touching the package.

1. Publish the default template so you have a copy to work from:

This copies the built-in template to resources/prompts/ai-filters/filter-agent.md.

2. Point the plugin at your file either via .env:

or directly in config/ai-filters.php:

When prompt_path is null, the built-in template is used.

3. Placeholders — the template is rendered with strtr() against:

Placeholder Replaced with
{{available}} pretty-printed JSON list of filters + fields + rules + options
{{current}} JSON of the current tableFilters state
{{searchable}} JSON array of searchable column names
{{currentSearch}} current global search value
{{extra}} rendered ai-filters.instructions text (empty when not set)

Any placeholder you omit is simply not rewritten — keep only what you need.

Configuration reference

config/ai-filters.php:

Key Purpose
provider Name of the laravel/ai provider to use (anthropic, openai, ...).
model Specific model id. null = provider default.
api_key Optional. Overrides the provider's configured API key at boot.
instructions Free text appended to the agent's system prompt. Use for table-specific business rules.
prompt_path Absolute path to a Markdown prompt template. null = built-in template.
action.* Visual defaults for the action button and modal.

How it works

  1. The user clicks AI Filter and types a prompt.
  2. The plugin reads the table's filters via $table->getFilters() and extracts each filter's name, type, accepted form-field keys, and (for SelectFilter) its options.
  3. It also reads the current $livewire->tableFilters and $livewire->tableSearch.
  4. All of the above is passed to a FilterAgent (a laravel/ai Agent with HasStructuredOutput), which returns:

  5. The plugin merges those updates back into $livewire->tableFilters (and sets $livewire->tableSearch if the AI returned a search query).
  6. Filament re-renders the table with the new state.

Troubleshooting

AI provider [anthropic] has insufficient credits or quota

Anthropic free credit grants are scoped to the Workbench / Claude Code, not the API. Add real billing credit at console.anthropic.com → Billing and create a fresh API key afterwards.

model: claude-3-5-haiku-20241022 not found

Some legacy models are not enabled on every tier. Switch to a current model:

"No matching filters" warning

The AI couldn't map the request to any available filter. Either:

Verify config is loaded after .env changes

Inspecting the agent's raw response

A Log::info('AiFilterAction', [...]) entry is written on every run. Check storage/logs/laravel.log to see the prompt, the filter list sent to the AI, and the structured response it returned.

Architecture

Credits

License

MIT


All versions of ai-filters with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
filament/filament Version ^4.0 || ^5.0
laravel/ai Version ^0.6 || ^1.0
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 webdirect/ai-filters contains the following files

Loading the files please wait ...