PHPackages                             hassanalisalem/querybuilder - 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. hassanalisalem/querybuilder

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

hassanalisalem/querybuilder
===========================

This package is used to build a query from jQuery Query builder plugin rules.

v1.1.2(7y ago)465MITPHPPHP ~5.6|~7.0

Since Apr 28Pushed 7y ago2 watchersCompare

[ Source](https://github.com/my-tiny-experiments/querybuilder)[ Packagist](https://packagist.org/packages/hassanalisalem/querybuilder)[ Docs](https://github.com/hassanalisalem/querybuilder)[ RSS](/packages/hassanalisalem-querybuilder/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (3)Versions (11)Used By (0)

Laravel QueryBuilder for jQuery Query Builder
=============================================

[](#laravel-querybuilder-for-jquery-query-builder)

[jQuery Query Builder](http://querybuilder.js.org/)
---------------------------------------------------

[](#jquery-query-builder)

this package is to build query form jQuery Query Builder library, it works with laravel models, and it uses the model relations. Also it hide your table structure, so you dont need to name the filters as your table columns

Structure
---------

[](#structure)

Install
-------

[](#install)

Via Composer

```
$ composer require hassanalisalem/querybuilder
```

Usage
-----

[](#usage)

in your controller or whatever place you are building your query

```
use hassanalisalem\querybuilder\Query;
...
...

$model = new User();
$rules = $request->rules; // rules from the jQuery query builder form.
$query = Query::build($model, $rules);
// you can use it as: $query->get() to get the query result
// or to check the query string: $query->toSql()
```

in the model
------------

[](#in-the-model)

you should define a public array variable named filterable. This should contain all your filters as filter id or key (from the jquery query builder filters) =&gt; filter value.

incase of ambiguous key you can add "as". so if I have table named industries and I want to query whereIn('id', \[\])... so the key should be 'filter\_name\_industries' =&gt; 'industries.id as industries'

```
public $filterable = [
    'filter_name' => 'this.name',
    'filter_user_post_title' => 'posts.title',
    'filter_user_post_comment' => 'posts.comments.text',
    'filter_industry' => 'industries.id as industries', // if there is ambiguous key.
    // it is recommended to prepend the key with 'filter_'
];
```

this means that the name source is the model itself. posts means that the title is from another relation named posts (posts) should be a function in the model that returns a relation.. also comments is a function in Post that returns a relation..

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity64

Established project with proven stability

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

Recently: every ~40 days

Total

10

Last Release

2775d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/510f178820f545b4ff2e9a4315eb5464a7c4fb099ba501cb94e91863be3409ef?d=identicon)[anacoder](/maintainers/anacoder)

---

Top Contributors

[![hsalem7](https://avatars.githubusercontent.com/u/6441901?v=4)](https://github.com/hsalem7 "hsalem7 (19 commits)")

---

Tags

querybuilderhassanalisalem

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/hassanalisalem-querybuilder/health.svg)

```
[![Health](https://phpackages.com/badges/hassanalisalem-querybuilder/health.svg)](https://phpackages.com/packages/hassanalisalem-querybuilder)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)[mrmarchone/laravel-auto-crud

Laravel Auto CRUD helps you streamline development and save time.

28711.8k2](/packages/mrmarchone-laravel-auto-crud)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)

PHPackages © 2026

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