PHPackages                             web-id/flan - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Search &amp; Filtering](/categories/search)
4. /
5. web-id/flan

ActiveProject[Search &amp; Filtering](/categories/search)

web-id/flan
===========

FLAN - Filter Like A Ninja

0.1.0(4y ago)53.2k↓66.7%1MITPHPPHP ^7.4|^8.0

Since Mar 3Pushed 3y ago9 watchersCompare

[ Source](https://github.com/web-id-fr/flan)[ Packagist](https://packagist.org/packages/web-id/flan)[ Docs](https://github.com/web-id/flan)[ GitHub Sponsors](https://github.com/web-id-fr)[ RSS](/packages/web-id-flan/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (7)Versions (12)Used By (0)

FLAN - Filter like a ninja 🥷
============================

[](#flan---filter-like-a-ninja-)

Installation
------------

[](#installation)

Require this package with composer.

```
composer require web-id/flan
```

FLAN uses Laravel Package Auto-Discovery, and doesn't require you to manually add the ServiceProvider.

Copy the package config to your local config with the publish command:

```
php artisan vendor:publish --provider="WebId\Flan\FlanServiceProvider"
```

Finally, run the filter tables migration

```
php artisan migrate
```

Usage
-----

[](#usage)

You can create a filter with:

```
php artisan filter:create User
```

or eventually just the Filter class:

```
php artisan make:filter:class User
```

or just the Filter config:

```
php artisan make:filter:config User
```

Filter configuration
--------------------

[](#filter-configuration)

You can find the configuration files for your Filters in the folder `config/FilterConfigs`

A configuration file is made of two entries `name` and `filters`:

```
return [
    'name' => 'myfilter',
    'filters' => [
        [
            'text' => 'Model ID',
            'name' => 'id',
            'active' => true,
            'field' => [
                'type' => 'number',
            ],
        ],
        // [ ... ]
    ],
];
```

### Configuration for any field type:

[](#configuration-for-any-field-type)

- `filters.*.text` is the HTML input label
- `filters.*.name` is the HTML input name attribute
- `filters.*.active` determines if the data will be shown in the table
- `filters.*.filterable` determines if the filter input will be shown for this column
- `filters.*.field` contains options to apply on the input
- `filters.*.field.type` is the input type, it can be one of those: `checkbox`, `date`, `number`, `select`, `text`

### Configuration specific to `select` type:

[](#configuration-specific-to-select-type)

- `filters.*.field.options` contains the list of the available select options. Here an example:

```
'options' => [
    [
        'value' => '0',
        'text' => 'Disabled',
    ],
    [
        'value' => '1',
        'text' => 'Enabled',
    ],
    // [ ... ],
],
```

Filter class
------------

[](#filter-class)

### The `custom_select` definition attribute

[](#the-custom_select-definition-attribute)

Let's say you are defining a `BookFilter` class, and you want to format the number of pages value:

```
$this->setDefinition('number_of_pages', [
    'custom_select' => 'CONCAT(`number_of_pages`, " pages")',
]);
```

### The `join` definition attribute

[](#the-join-definition-attribute)

Let's say you are defining a `BookFilter` class, and you want to be able to filter on the book's author birth city for example.

If you want to use a custom select with a join clause, in your Filter class constructor you can do this:

```
$this->setDefinition('author_birth_city', [
    'join' => 'leftJoinAuthorsTable',
    'custom_select' => '`authors`.`birth_city`',
]);
```

Then, you need to add a method named after your `join` parameter to apply the join on the query, in this example:

```
protected function leftJoinAuthorsTable(): void
{
    $this->query->leftJoin(
        'authors',
        'books.author_id',
        '=',
        'authors.id'
    );
}
```

Credits
-------

[](#credits)

- [Leo Tiollier](https://github.com/LTiollier)
- [Julien Cauvin](https://github.com/jucau)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 67.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~109 days

Total

2

Last Release

1786d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cefb02231110e801ec332d70b4bb7f1df97a12f095e0c1ea887d3273d74cde78?d=identicon)[web-id](/maintainers/web-id)

---

Top Contributors

[![LTiollier-WebID](https://avatars.githubusercontent.com/u/32257844?v=4)](https://github.com/LTiollier-WebID "LTiollier-WebID (33 commits)")[![JulienCauvin](https://avatars.githubusercontent.com/u/33349012?v=4)](https://github.com/JulienCauvin "JulienCauvin (6 commits)")[![LTiollier](https://avatars.githubusercontent.com/u/16253697?v=4)](https://github.com/LTiollier "LTiollier (5 commits)")[![francoisWebID](https://avatars.githubusercontent.com/u/37926647?v=4)](https://github.com/francoisWebID "francoisWebID (3 commits)")[![fransua-kwek](https://avatars.githubusercontent.com/u/57180334?v=4)](https://github.com/fransua-kwek "fransua-kwek (2 commits)")

---

Tags

laravelpackagefilterFlan

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/web-id-flan/health.svg)

```
[![Health](https://phpackages.com/badges/web-id-flan/health.svg)](https://phpackages.com/packages/web-id-flan)
```

###  Alternatives

[awesome-nova/filter-card

A Laravel Nova card.

25126.1k](/packages/awesome-nova-filter-card)[pos-lifestyle/laravel-nova-date-range-filter

A Laravel Nova date range filter.

16179.1k](/packages/pos-lifestyle-laravel-nova-date-range-filter)[tapp/filament-value-range-filter

Filament country code field.

2362.2k](/packages/tapp-filament-value-range-filter)[webbingbrasil/filament-datefilter

Date filter component for filament tables.

1479.4k](/packages/webbingbrasil-filament-datefilter)[ambengers/query-filter

Laravel package for filtering resources with request query string

3513.5k](/packages/ambengers-query-filter)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
