PHPackages                             and48/table-filters - 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. [Database &amp; ORM](/categories/database)
4. /
5. and48/table-filters

ActiveLibrary[Database &amp; ORM](/categories/database)

and48/table-filters
===================

Making Eloquent models filterable.

1.0.1(2y ago)3155↓50%MITPHP

Since Jul 15Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/AND48/table-filters)[ Packagist](https://packagist.org/packages/and48/table-filters)[ RSS](/packages/and48-table-filters/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

Table filters for Laravel 8
===========================

[](#table-filters-for-laravel-8)

Package for making Eloquent models filterable.

Setup
=====

[](#setup)

Composer
--------

[](#composer)

Pull this package in through Composer

```
composer require and48/table-filters
```

Publish migrations
------------------

[](#publish-migrations)

Publish the package migrations files to your application.

```
php artisan vendor:publish --provider="AND48\TableFilters\TableFiltersServiceProvider" --tag="migrations"
```

Run migrations.

```
php artisan migrate
```

Publish configuration
---------------------

[](#publish-configuration)

Publish the package configuration file to your application.

```
php artisan vendor:publish --provider="AND48\TableFilters\TableFiltersServiceProvider" --tag="config"
```

See configuration file [(`config/filters.php`)](https://github.com/AND48/table-filters/blob/master/config/config.php) yourself and make adjustments as you wish.

Usage
=====

[](#usage)

Create filters for model.

```
use AND48\TableFilters\Models\Filter;
...
User::addTableFilters([
    ['field' =>'id', 'type' => Filter::TYPE_NUMBER, 'caption' => 'ID'],
    ['field' =>'name', 'type' => Filter::TYPE_STRING, 'caption' => 'Name'],
    ['field' =>'birthday', 'type' => Filter::TYPE_DATE, 'caption' => 'Birthday'],
    ['field' =>'is_blocked', 'type' => Filter::TYPE_BOOLEAN, 'caption' => 'Is blocked'],
    ['field' =>'balance', 'type' => Filter::TYPE_NUMBER, 'caption' => 'Balance'],
    ['field' =>'status', 'type' => Filter::TYPE_ENUM, 'caption' => 'Status'],
    ['field' =>'parent_id', 'type' => Filter::TYPE_SOURCE, 'caption' => 'Parent user'],
]);
...
}
```

Use **TableFilterable** trait inside your *Eloquent* model(s).

Get your filters.

```
$filters = User::tableFilterList(true, [
                'status' => ['new', 'verified', 'active', 'suspended']]);
```

Get source data.

```
$filter = Filter::find($filter_id);
$source_data = $filter->sourceData($page, $search_query);
```

Load source data by route.

```
route('filters.source_data', ['filter_id' => 1, 'query' => '*', 'page' => 2]);
```

Filtering model.

```
$filters = [
    ['id' => 1, 'operator' => '!=', 'values' => [2, 3]],
    ['id' => 2, 'operator' => '~', 'values' => ['and', 'dy']],
    ['id' => 3, 'operator' => '>=', 'values' => ['1986-06-06']],
    ['id' => 4, 'operator' => '=', 'values' => [false]],
    ['id' => 6, 'operator' => '=', 'values' => ['new', 'verified']],
    ['id' => 7, 'operator' => '!=', 'values' => []],
];
$users = User::tableFilter($filters)->get();
```

For save, update or delete filters to storage (db table), please use resource route **filters.storages**.

Use it with client library [`table-filters-client`](https://www.npmjs.com/package/table-filters-client)

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance58

Moderate activity, may be stable

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~377 days

Total

2

Last Release

1026d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4b713b5a86c04c9541d4277206ffbcfd6a3df8f55d469b1e88b8435c6a7a89d9?d=identicon)[AND48](/maintainers/AND48)

---

Top Contributors

[![AND48](https://avatars.githubusercontent.com/u/34770539?v=4)](https://github.com/AND48 "AND48 (67 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/and48-table-filters/health.svg)

```
[![Health](https://phpackages.com/badges/and48-table-filters/health.svg)](https://phpackages.com/packages/and48-table-filters)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90440.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)[wildside/userstamps

Laravel Userstamps provides an Eloquent trait which automatically maintains `created\_by` and `updated\_by` columns on your model, populated by the currently authenticated user in your application.

7511.7M13](/packages/wildside-userstamps)

PHPackages © 2026

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