PHPackages                             farzin/filter-maker - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. farzin/filter-maker

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

farzin/filter-maker
===================

A package for make clean filters for your data tables

17PHP

Since Dec 21Pushed 8y agoCompare

[ Source](https://github.com/farzinft/filter-maker)[ Packagist](https://packagist.org/packages/farzin/filter-maker)[ RSS](/packages/farzin-filter-maker/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

filter-maker
============

[](#filter-maker)

(Laravel 5.5)

when you need to make query string filters probably you are some of persons that use **if statement** to extend **Laravel QueryBuilder** to make your final query, so its a bad method and hard to maintaining your code in the feature, by this package you can see magic of implementation of queryString filters.

---

step1
-----

[](#step1)

install:

> composer require farzin/filter-maker:"dev-master"

Add service provider:

> Farzin\\FilterMaker\\FilterMakerProvider::class

publish config file :

```
php artisan vendor:publish

```

now in laravel config folder you can see filter-maker config file, suppose you have a user list and want to make query string filter like :

> /users?first\_name=test&amp;last\_name=test

you can define your config file like :

```
return [
    'UserFilter' => [
       //inputs
        'first_name',
        'last_name'
    ]
];

```

step2
-----

[](#step2)

now run this command:

> php artisan make:filter

now in app directory you can see Filters directory and UserFilter class. you see methods that created for each one of inputs, this is place which you can define your query builder statement: example:

```
public function firstName($value)
{
	$this->builder->where('first_name', $value);
}

public function lastName($value)
{
	$this->builder->where('last_name', $value);
}

```

step3
-----

[](#step3)

make a custom service provider :

> php artisan make:provider SampleServiceProvider

and add this provider in your app.php config file. we have to defer loading of this provider because we don't need to load this provider in every request. we use laravel Contextual binding to bind builder to our filter class, read more: [Contextual binding ](https://laravel.com/docs/5.5/container#contextual-binding)

**a sample provider** :

```
    protected $defer = true;
    public function register()
{
    $this->app->when(UserFilter::class)->needs(Builder::class)->give(function () {
        return #query;
    });
}

public function provides()
{
    return [
     UserFilter::class
    ];
}

```

now in your Controller method inject filter and use **applyFilter()** method now you have filtered query ! that's it! , you can use this builder instance in datatable... example:

```
public function userList(Request $request, App\Filters\UserFilter $userFilter)
{
    $query = $userFilter->applyFilter(); // Builder Instance
}

```

> any time you can add new queryString variables to config file, just add its to array and run artisan command

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/7bd93b593dba197ea128bba25fe750f90163d3a6fd2775be66d0828342fe5f14?d=identicon)[farzinft](/maintainers/farzinft)

---

Top Contributors

[![farzinft](https://avatars.githubusercontent.com/u/20719437?v=4)](https://github.com/farzinft "farzinft (6 commits)")

### Embed Badge

![Health badge](/badges/farzin-filter-maker/health.svg)

```
[![Health](https://phpackages.com/badges/farzin-filter-maker/health.svg)](https://phpackages.com/packages/farzin-filter-maker)
```

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

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