PHPackages                             koochik/queryhall - 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. koochik/queryhall

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

koochik/queryhall
=================

A PHP package that allows you to sort, filter, and paginate Doctrine DBAL SQL database queries from Query parameters

3247PHP

Since Jul 21Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/sepehrshariati/QueryHall)[ Packagist](https://packagist.org/packages/koochik/queryhall)[ RSS](/packages/koochik-queryhall/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

QueryHall
=========

[](#queryhall)

QueryHall is a PHP library that allows you to sort, filter, and paginate query builder instances of a database abstraction layer of your choice, such as Doctrine DBAL or Eloquent. It ships with a ready-to-use concrete class for DBAL that allows filtering, sorting, and paginating Doctrine DBAL queries based on a PSR request object (using the query parameters).

Features
--------

[](#features)

- **Abstract Query Builder**: Easily integrate with various database abstraction layers.
- **Sorting**: Sort your queries based on multiple criteria.
- **Filtering**: Apply complex filters to your queries.
- **Pagination**: Efficiently paginate your query results.
- **PSR-7 Compatibility**: Works seamlessly with PSR-7 request objects.
- **Flexible Query Parsing Algorithm**: Easily parse query parameters with a customizable parser that can be swapped.
- **Built-in BasicValidator**: Validate filter rules with the built-in `BasicValidator`.
- **Highly Customizable**: Customize almost every aspect of this library, including

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

[](#installation)

Install the library via Composer:

```
composer require koochik/queryhall
```

Using the built-in Dbal implementaion
-------------------------------------

[](#using-the-built-in-dbal-implementaion)

```
$app->get('/users', function (Request $request) {
    $queryString = $request->getUri()->getQuery();
    parse_str($queryString, $queryParams);

    $connectionParams = [
        'dbname' => 'DataBase',
        'user' => 'root',
        'password' => '',
        'host' => 'localhost',
        'driver' => 'pdo_mysql',
    ];

    $conn = DriverManager::getConnection($connectionParams);
    $queryBuilder = $conn->createQueryBuilder();
    $queryBuilder->select('*')->from('users');

    $queryHall = new SortAndPaginate($queryBuilder, $queryParams);
    $response = new Response();
    $data = $queryHall->getPaginatedResult();

    $response->getBody()->write(json_encode($data));
    return $response->withHeader('Content-Type', 'application/json');
});

```

Then the request `users?where=[id,>,2]&sort=[name,-1]&perPage=5&p=2`would Get users with `id > 2`, Sort by `name` in descending order, paginate with 5 items per page, and return the result from page 2. the result is somthing like

```

```

```
{
    "data": [
        {
            "id": 4,
            "name": "Emily",
            "lastName": "Brown",
            "age": 35,
            "isActive": 1,
            "height": 170.8
        },
        {
            "id": 5,
            "name": "Daniel",
            "lastName": "Williams",
            "age": 22,
            "isActive": 0,
            "height": 176.5
        },
        {
            "id": 9,
            "name": "Benjamin",
            "lastName": "Martinez",
            "age": 31,
            "isActive": 1,
            "height": 180.6
        }
    ],
    "meta": {
        "current_page": 2,
        "per_page": 5,
        "last_page": 2,
        "total": 8,
        "from": 6,
        "to": 8
    }
}
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance40

Moderate activity, may be stable

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity14

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/30bff5a9f917e10936de13e0b95835146067642fad133f620b75e83cbe988498?d=identicon)[koochik](/maintainers/koochik)

---

Top Contributors

[![sepehrshariati](https://avatars.githubusercontent.com/u/90236581?v=4)](https://github.com/sepehrshariati "sepehrshariati (7 commits)")

### Embed Badge

![Health badge](/badges/koochik-queryhall/health.svg)

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

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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