PHPackages                             ensi/laravel-query-builder-helpers - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. ensi/laravel-query-builder-helpers

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ensi/laravel-query-builder-helpers
==================================

This package contains extensions for laravel-query-builder

0.1.14(4mo ago)141.2k↓18.3%1MITPHPPHP ^8.1CI passing

Since May 2Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/ensi-platform/laravel-query-builder-helpers)[ Packagist](https://packagist.org/packages/ensi/laravel-query-builder-helpers)[ RSS](/packages/ensi-laravel-query-builder-helpers/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (9)Versions (17)Used By (0)

laravel-query-builder-helpers
=============================

[](#laravel-query-builder-helpers)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e667492e829e12ef0966370cdf2f3fca32765a1e50ef7f7be592adfe14851872/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656e73692f6c61726176656c2d71756572792d6275696c6465722d68656c706572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ensi/laravel-query-builder-helpers)[![Tests](https://github.com/ensi-platform/laravel-php-rdkafka/actions/workflows/run-tests.yml/badge.svg?branch=master)](https://github.com/ensi-platform/laravel-php-rdkafka/actions/workflows/run-tests.yml)[![Total Downloads](https://camo.githubusercontent.com/d2c19057288980e5e80705335293efd0b37a9a9979b323745c5b2ab561099404/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656e73692f6c61726176656c2d71756572792d6275696c6465722d68656c706572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ensi/laravel-query-builder-helpers)

The laravel-query-builder-helper package is a set of classes that simplify the creation of available filters for the laravel-query-builder package from Spatie.

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

[](#installation)

You can install the package via composer:

```
composer require ensi/laravel-query-builder-helpers
```

Version Compatibility
---------------------

[](#version-compatibility)

Laravel query builder helpersLaravelPHP^0.1.0^9.x^8.1^0.1.4^9.x || ^10.x^8.1^0.1.7^9.x || ^10.x || ^11.x^8.1^0.1.14^9.x || ^10.x || ^11.x || ^12.x^8.1Basic Usage
-----------

[](#basic-usage)

### Creating a filter

[](#creating-a-filter)

Filters are created by applying the static **make** method and then calling the chain of filter methods.

```
use Ensi\QueryBuilderHelpers\Filters\StringFilter;

StringFilter::make('name')->contain()->endWith()->empty();
```

The following filter classes are currently available:

- StringFilter
- NumericFilter
- DateFilter
- PlugFilter (a stub for passing additional parameters to another filter)
- ExtraFilter (described in the section "Additional filters")

Each filter type has its own suffix, which is added to the name passed to the **make** method. For example, by default, the filter **empty** has the suffix **\_empty**, and the filter **gt** is **\_gt**:

```
NumericFilter::make('rank')->exact()->empty()->gt()->lt();
```

As a result, we will get four filtering options available for search queries.

- rank
- rank\_empty
- rank\_gt
- rank\_lt

### Passing filters to the allowed Filters method

[](#passing-filters-to-the-allowed-filters-method)

To transfer the received filters to the `allowedFilters` method of the Spatie package, the array will need to be destructured.

```
$this->allowedFilters([
    ...NumericFilter::make('rank')->exact()->empty()->gt()->lt(),
]);
```

### Additional filters

[](#additional-filters)

The **ExtraFilter** class is used by the aforementioned classes, but can also be used separately.

Useful methods include:

- nested (registers a set of nested filters)
- predefined (creates a predefined filter that includes complex filtering)
- and others

```
...ExtraFilter::nested('page', [
    ...InputFilter::make('title', 'page_title')->empty()->exact()->contain(),
]),
```

Configuration
-------------

[](#configuration)

In the file \*\*config.php \*\* you can customize the applied suffixes. You can also set up the like operator used in search queries there.

```
'suffixes' => [
    'equal' => '',
    'greater' => '_gt',
    'less' => '_lt',
    ...
],

'like_operator' => 'LIKE',
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

### Testing

[](#testing)

1. composer install
2. composer test

By default, testing takes place using in-memory DataBase SQLite. SQLite does not support some functions, for example: json\_contains. To test these functions, copy `phpunit.xml.dist` to `phpunit.xml` and specify the configuration with connection to another database in the *php* section. When writing such tests, use the *skip* function to skip tests using the default connection.

```
->skip(fn () => DB::getDriverName() === 'sqlite', 'db driver does not support this test');
```

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](.github/SECURITY.md) on how to report security vulnerabilities.

License
-------

[](#license)

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

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance74

Regular maintenance activity

Popularity32

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~74 days

Total

15

Last Release

145d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8089373?v=4)[Наталия](/maintainers/MsNatali)[@MsNatali](https://github.com/MsNatali)

![](https://avatars.githubusercontent.com/u/7352966?v=4)[Andrey](/maintainers/dimionx)[@DimionX](https://github.com/DimionX)

---

Top Contributors

[![MsNatali](https://avatars.githubusercontent.com/u/8089373?v=4)](https://github.com/MsNatali "MsNatali (12 commits)")[![C0rTeZ13](https://avatars.githubusercontent.com/u/120840631?v=4)](https://github.com/C0rTeZ13 "C0rTeZ13 (6 commits)")[![DimionX](https://avatars.githubusercontent.com/u/7352966?v=4)](https://github.com/DimionX "DimionX (5 commits)")[![egmanoylin](https://avatars.githubusercontent.com/u/77325193?v=4)](https://github.com/egmanoylin "egmanoylin (2 commits)")[![valerialukinykh](https://avatars.githubusercontent.com/u/123940772?v=4)](https://github.com/valerialukinykh "valerialukinykh (2 commits)")[![AlexeiBereza](https://avatars.githubusercontent.com/u/35576706?v=4)](https://github.com/AlexeiBereza "AlexeiBereza (1 commits)")[![imamberdievf](https://avatars.githubusercontent.com/u/79088728?v=4)](https://github.com/imamberdievf "imamberdievf (1 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ensi-laravel-query-builder-helpers/health.svg)

```
[![Health](https://phpackages.com/badges/ensi-laravel-query-builder-helpers/health.svg)](https://phpackages.com/packages/ensi-laravel-query-builder-helpers)
```

###  Alternatives

[wireui/wireui

TallStack components

1.8k1.3M16](/packages/wireui-wireui)[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4205.3M84](/packages/livewire-volt)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)

PHPackages © 2026

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