PHPackages                             labrodev/laravel-filter-components - 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. [Admin Panels](/categories/admin)
4. /
5. labrodev/laravel-filter-components

ActiveLibrary[Admin Panels](/categories/admin)

labrodev/laravel-filter-components
==================================

Package to extend filters for CRUD (with using Spatie Laravel Query Builder)

v1.0.2(1y ago)134MITPHPPHP &gt;=8.1

Since Nov 18Pushed 1y ago1 watchersCompare

[ Source](https://github.com/labrodev/laravel-filter-components)[ Packagist](https://packagist.org/packages/labrodev/laravel-filter-components)[ Docs](https://github.com/labrodev/laravel-filter-components)[ RSS](/packages/labrodev-laravel-filter-components/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (16)Versions (4)Used By (0)

labrodev/laravel-filter-components
==================================

[](#labrodevlaravel-filter-components)

---

This repo is Laravel package to extend filtering functionality in Laravel projects. If you have a list with items and you use spatie/laravel-query-builder to filter them, this package could be useful for you.

This package based on [spatie/laravel-query-builder](https://github.com/spatie/laravel-query-builder) use case. We express our appreciation to Spatie for inspiring us, sharing valuable experiences, and providing exceptional Laravel packages that we not only extensively use but also wholeheartedly recommend.

QueryBuilder classes
--------------------

[](#querybuilder-classes)

In this package you may find some custom part of Query Builder to extend filtering logic.

**DateRangeFilter**

QueryBuilder class which implements a logic to filter by range of dates using WhereBetween.

**IsNotNullFilter**

QueryBuilder class which implements a logic to filter by whereNull or whereNotNull depend on the given input value. Could be used when we just need to filter by some flag behind which there is a logic (like: Have unpaid invoices - Yes/No).

**WhereInFilter**

QueryBuilder class which implements a logic to filter b whereIn using given array of values (good for multiple selects as filters).

View components
---------------

[](#view-components)

Also in this package you may find filter components that render filter component depends on type and logic.

You may public vendor views from this package to implement your own styles for filter components blade templates and to adjust it to your layout and theme.

By default filter components in blade use Bootstrap classes.

**Boolean filter**

View component to render a filter with select options No,Yes (or custom options defined in component attribute).

**Custom select filter**

View component to render a filter with custom select options as filter options.

**Date range filter**

View component to render a filter with two date inputs as date range (start date and end date).

**Input filter**

View component to render a filter with text input.

**Multiple select field**

View component to render a filter with multiple select options from given Eloquent Model.

**Select field**

View component to render a filter with select options from given Eloquent Model.

**Link**

View component to render a sort field.

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

[](#installation)

You can install the package via composer:

```
composer require labrodev/laravel-filter-components
```

Optionally, you can publish the views to implement them to your layout.

```
php artisan vendor:publish --tag=filter-components-views
```

Optionally, you can publish the view components to extend the logic you need.

```
php artisan vendor:publish --tag=filter-components-components
```

Usage
-----

[](#usage)

### QueryBuilder classes

[](#querybuilder-classes-1)

Let's assume that you are familiar with [Spatie\\QueryBuilder](https://spatie.be/docs/laravel-query-builder/v5/introduction) and already implemented filtering logic using Spatie\\QueryBuilder.

You may extend usage by using QueryBuilder classes from this package: DateRangeFilter, WhereInFilter, IsNotNullFilter.

```
use Illuminate\Http\Request;
use Labrodev\Filters\QueryBuilder\DateRangeFilter;
use Labrodev\Filters\QueryBuilder\WhereInFilter;
use Labrodev\Filters\QueryBuilder\IsNotNullFilter;
use Spatie\QueryBuilder\AllowedFilter;
use Spatie\QueryBuilder\QueryBuilder;

class YourQuery extends QueryBuilder
{
    public function __construct(Request $request)
    {
        $query = YourModel::query();

        parent::__construct($query, $request);

        //DateRangeFilter
        $this->allowedFilters([
            AllowedFilter::custom('filter_name', new DateRangeFilter(), 'table_column')
        ]);

        //DateRangeFilter
        $this->allowedFilters([
            AllowedFilter::custom('filter_name', new WhereInFilter(), 'table_column')
        ]);

        //IsNotNullFilter
        $this->allowedFilters([
            AllowedFilter::custom('filter_name', new IsNotNullFilter(), 'table_column')
        ]);
    }
}
```

### View components

[](#view-components-1)

Let's consider that you want to have a filtering in your CRUD list.

There could be a filter block. Let's assume to may have a form for your filters.

```

```

**Boolean filter**

```

```

- field - this property is query parameter which will be in search request
- name - this is label for this filter
- options - options which will be in select box; if it is not provided, then it will No, Yes options by default

**Custom select filter**

```

    field="filter[{{ $filterField }}]"
    name="{{ __('Filter label') }}"
    options="{{__('Your option 1') }},{{ __('Your option 2')}}">

```

- field - this property is query parameter which will be in search request
- name - this is label for this filter
- options - options which will be in select box

**Date range filter**

```

    field="filter[{{ $filterField }}]"
    name="{{ __('Filter label') }}">

```

- field - this property is query parameter which will be in search request
- name - this is label for this filter

**Input filter**

```

    field="filter[{{ $filterField }}]"
    name="{{ __('Filter label') }}">

```

- field - this property is query parameter which will be in search request
- name - this is label for this filter

**Multiple select filter**

```

```

- field - this property is query parameter which will be in search request
- name - this is label for this filter
- class - Eloquent model class from where will be taken values for options. For example, if class is App\\Models\\UserGroup, then will be rendered all user groups from `user_groups` table as options
- value - property which will be shown as options. For example, if value will be `name`, column `name` from `user_groups` table will be used for option; if you want to split two columns to have them as option, put in value them separeted by comma: 'column1,column2'

**Select filter**

```

```

- field - this property is query parameter which will be in search request
- name - this is label for this filter
- class - Eloquent model class from where will be taken values for options. For example, if class is App\\Models\\UserGroup, then will be rendered all user groups from `user_groups` table as options
- value - property which will be shown as options. For example, if value will be `name`, column `name` from `user_groups` table will be used for option; if you want to split two columns to have them as option, put in value them separeted by comma: 'column1,column2'

**Link**

```

```

- name - field to sort

Testing
-------

[](#testing)

```
composer test
```

PhpStan check
-------------

[](#phpstan-check)

```
composer analyse
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

- [Labro Dev](https://github.com/labrodev)
- [Spatie](https://github.com/spatie)

License
-------

[](#license)

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

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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 ~197 days

Total

3

Last Release

516d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b29c2afb9bfe2502125a5403436be931d78a8be09fffd77d4225664b1c13d7ed?d=identicon)[labrodev](/maintainers/labrodev)

---

Top Contributors

[![labrodev](https://avatars.githubusercontent.com/u/151143718?v=4)](https://github.com/labrodev "labrodev (7 commits)")

---

Tags

crudfilterslaravellaravel-componentslaravel-frameworklaravel-packagelaravel-spatiephplaravellaravel-packagelaravel-filterslabrodevlaravel-filter-components

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/labrodev-laravel-filter-components/health.svg)

```
[![Health](https://phpackages.com/badges/labrodev-laravel-filter-components/health.svg)](https://phpackages.com/packages/labrodev-laravel-filter-components)
```

###  Alternatives

[guava/filament-knowledge-base

A filament plugin that adds a knowledge base and help to your filament panel(s).

206120.5k1](/packages/guava-filament-knowledge-base)[ralphjsmit/laravel-filament-seo

A package to combine the power of Laravel SEO and Filament Admin.

15398.7k10](/packages/ralphjsmit-laravel-filament-seo)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[geo-sot/filament-env-editor

Access .env file though Filament admin panel

2432.3k1](/packages/geo-sot-filament-env-editor)[caresome/filament-neobrutalism-theme

A neobrutalism theme for FilamentPHP admin panels

303.2k](/packages/caresome-filament-neobrutalism-theme)[andreia/filament-ui-switcher

Add a modal with options to switch between different UI layouts and styles (colors, fonts, font sizes).

233.8k](/packages/andreia-filament-ui-switcher)

PHPackages © 2026

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