PHPackages                             artnum/structured-json-query - 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. artnum/structured-json-query

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

artnum/structured-json-query
============================

Convert a specific JSON structure to a SQL query or LDAP filter

v0.0.5(2y ago)04MITPHP

Since Mar 29Pushed 2y ago1 watchersCompare

[ Source](https://github.com/artnum/structured-json-query)[ Packagist](https://packagist.org/packages/artnum/structured-json-query)[ RSS](/packages/artnum-structured-json-query/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (6)Used By (0)

Structured JSON Query
=====================

[](#structured-json-query)

Convert a JSON object into an SQL where clause or into an LDAP filter.

JSON Query Object
-----------------

[](#json-query-object)

### AND, OR

[](#and-or)

Nesting of fields with AND and OR is possible with the keys #and and #or. This fields must take an object as a value. Nesting has no imposed limit on deepness.

### Default operator and type

[](#default-operator-and-type)

With no specific type and operator, it will default to equality operator and string type

```
{
    "#and": {
        "name": "John Doe",
        "city": "New York"
    }
}
```

Result :

- SQL -&gt; name = "John Doe" AND city = "New York"
- LDAP -&gt; (&amp;(name=John Doe)(city=New York))

### Sepcific type and operator

[](#sepcific-type-and-operator)

You can specify type and/or operator :

```
{
    "#and": {
        "name": {"operator": "~", "type": "str", "value": "Jo*"},
        "age": {"operator": ">=", "type": "int", "value": 21}
    }
}
```

Result:

- SQL -&gt; name LIKE "Jo%" AND age &gt;= 21
- LDAP -&gt; (&amp;(name=Jo\*)(age&gt;=21))

### Nesting example

[](#nesting-example)

```
{
    "or": {
        "name": {"operator": "~", "value": "J*"},
        "#and": {
            "age": {"operator": "", "type": "int", "value": 18}
        }
    }
}
```

Result :

- SQL -&gt; (name LIKE "J\*" OR (age &lt; 65 AND age &gt; 18))
- LDAP -&gt; (|(name=J\*)(|(age&lt;65)(age&gt;18)))

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

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

Total

5

Last Release

767d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

jsonldapquery-builderquery-languagesqljsonsqlqueryldap

### Embed Badge

![Health badge](/badges/artnum-structured-json-query/health.svg)

```
[![Health](https://phpackages.com/badges/artnum-structured-json-query/health.svg)](https://phpackages.com/packages/artnum-structured-json-query)
```

###  Alternatives

[rennokki/laravel-eloquent-query-cache

Adding cache on your Laravel Eloquent queries' results is now a breeze.

1.1k4.0M14](/packages/rennokki-laravel-eloquent-query-cache)[aura/sqlquery

Object-oriented query builders for MySQL, Postgres, SQLite, and SQLServer; can be used with any database connection library.

4572.9M34](/packages/aura-sqlquery)[annexare/countries-list

Continents &amp; countries: ISO 3166-1 alpha-2 code, name, ISO 639-1 languages, capital, currency, native name, phone. JSON, CSV and SQL.

1.3k220.8k1](/packages/annexare-countries-list)[nilportugues/sql-query-builder

An elegant lightweight and efficient SQL QueryInterface BuilderInterface supporting bindings and complicated query generation.

425239.4k6](/packages/nilportugues-sql-query-builder)[supliu/laravel-query-monitor

Laravel Query Monitor

287111.9k](/packages/supliu-laravel-query-monitor)[illuminated/db-profiler

Database Profiler for Laravel Web and Console Applications.

168237.4k](/packages/illuminated-db-profiler)

PHPackages © 2026

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