PHPackages                             glooby/doctrine-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. glooby/doctrine-query-builder

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

glooby/doctrine-query-builder
=============================

Very powerful query builder, perfect for apis

0.1.2(8y ago)29.7k2[2 PRs](https://github.com/glooby/doctrine-query-builder/pulls)MITPHPPHP &gt;=5.6

Since Mar 20Pushed 5y ago1 watchersCompare

[ Source](https://github.com/glooby/doctrine-query-builder)[ Packagist](https://packagist.org/packages/glooby/doctrine-query-builder)[ RSS](/packages/glooby-doctrine-query-builder/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (2)Versions (6)Used By (0)

doctrine-query-builder
======================

[](#doctrine-query-builder)

Very powerful query builder, perfect to use when building api's or have the need to build very flexible queries

Supports unlimited nested AND/OR groups, most of the common SQL operators, joins, order by, distinct etc

### Requirements:

[](#requirements)

- PHP &gt;= 5.6
- Symfony HTTP Foundation &gt; 3.2
- Doctrine ORM &gt; 2.5

### Installation:

[](#installation)

With [Composer](https://getcomposer.org/):

```
{
    "require": {
        "glooby/doctrine-query-builder": "dev-master"
    }
}
```

### Usage:

[](#usage)

```
use \Glooby\Doctrine\QueryBuilder\QueryBuilder;

$repo = $this->getDoctrine()->getManager()->getRepository('AcmeMainBundle:Person');
$qb = new QueryBuilder();

$results = $qb->build($repo, $data)->getQuery()->getResult();

return new JsonResponse($results);
```

### Example data:

[](#example-data)

```
{
    "alias": "p",
    "select": ["p.id"],
    "where": {
        "$or": {
            "p.city": {
                "$same": "c.city"
            },
            "p.zipCode": {
                "$same": "c.zipCode"
            },
            "p.street": {
                "$same": "c.street"
            },
        },
        "c.city": {
            "$in": [
                "New York",
                "London"
            ]
        },
        "c.employees": { "$equals": 1 },
        "l.code": 49,
        "p.country": "$not_null",
        "p.phone": "$is_null",
        "c.assets": { "$gte": 1000 },
        "c.turnover": { "$lt": 10000 },
        "t.code": {
            "$in": [1, 2, 3]
        },
        "r.title": {
            "$not_in": ":titles"
        }
    },
    "distinct": true,
    "params": {
        "titles": ["CFO", "CMO"]
    },
    "orderBy": {
        "p.name": "asc"
    },
    "join": {
        "p.roles": "r",
        "r.company": "c",
        "c.trades": {
            "alias": "t",
            "type": "left"
        }
    }
}
```

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity52

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.

###  Release Activity

Cadence

Every ~182 days

Total

3

Last Release

3027d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/325786?v=4)[Emil Kilhage](/maintainers/kilhage)[@kilhage](https://github.com/kilhage)

---

Top Contributors

[![kilhage](https://avatars.githubusercontent.com/u/325786?v=4)](https://github.com/kilhage "kilhage (16 commits)")

---

Tags

doctrinesqlsymfony

### Embed Badge

![Health badge](/badges/glooby-doctrine-query-builder/health.svg)

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

###  Alternatives

[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1189.8k](/packages/rcsofttech-audit-trail-bundle)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M386](/packages/easycorp-easyadmin-bundle)[kimai/kimai

Kimai - Time Tracking

4.8k9.0k1](/packages/kimai-kimai)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1616.4k14](/packages/2lenet-crudit-bundle)[ahmed-bhs/doctrine-doctor

Runtime analysis tool for Doctrine ORM integrated into Symfony Web Profiler. Unlike static linters, it analyzes actual query execution at runtime to detect performance bottlenecks, security vulnerabilities, and best practice violations during development with real execution context and data.

9410.8k](/packages/ahmed-bhs-doctrine-doctor)

PHPackages © 2026

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