PHPackages                             asseco-voice/laravel-json-query-builder - 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. asseco-voice/laravel-json-query-builder

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

asseco-voice/laravel-json-query-builder
=======================================

Laravel JSON query builder

v2.3.0(4mo ago)247.7k↓100%7[1 issues](https://github.com/asseco-voice/laravel-json-query-builder/issues)[7 PRs](https://github.com/asseco-voice/laravel-json-query-builder/pulls)2MITPHPPHP ^8.1CI passing

Since Feb 10Pushed 4mo ago6 watchersCompare

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

READMEChangelog (1)Dependencies (5)Versions (28)Used By (2)

[![](https://github.com/asseco-voice/art/raw/main/evil_logo.png)](https://see.asseco.com)

Laravel JSON query builder
==========================

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

This package enables building queries from JSON objects following the special logic explained below.

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

[](#installation)

Install the package through composer. It is automatically registered as a Laravel service provider.

`composer require asseco-voice/laravel-json-query-builder`

Usage
-----

[](#usage)

In order to use the package, you need to instantiate `JsonQuery()` providing two dependencies to it. One is `Illuminate\Database\Eloquent\Builder` instance, and the other is a JSON/array input.

Once instantiated, you need to run the `search()` method, and query will be constructed on the provided builder object.

```
$jsonQuery = new JsonQuery($builder, $input);
$jsonQuery->search();

```

Dev naming conventions for this package
---------------------------------------

[](#dev-naming-conventions-for-this-package)

- **parameter** is a top-level JSON key name (see the options [below](#parameter-breakdown))
- **arguments** are parameter values. Everything within a top-level JSON.
- **argument** is a single key-value pair.
- single argument is further broken down to **column / operator / value**

```
{
    "search": {
