PHPackages                             zooxsmart/los-uql - 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. zooxsmart/los-uql

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

zooxsmart/los-uql
=================

PHP library to transform url query into db partial queries

1.0.0(2y ago)01.5kMITPHP &gt;=8.1

Since Sep 19Pushed 2y agoCompare

[ Source](https://github.com/zooxsmart/uql)[ Packagist](https://packagist.org/packages/zooxsmart/los-uql)[ Docs](https://github.com/lansoweb/uql)[ GitHub Sponsors](https://github.com/Lansoweb)[ RSS](/packages/zooxsmart-los-uql/feed)WikiDiscussions master Synced 1mo ago

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

UQL - Url Query language
========================

[](#uql---url-query-language)

[![Build Status](https://camo.githubusercontent.com/79b9abaf2e0875d1bef53aef16e40af6f480031a73d667c3006494706c472cdb/68747470733a2f2f7472617669732d63692e6f72672f4c616e736f7765622f75716c2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Lansoweb/uql)[![Coverage Status](https://camo.githubusercontent.com/1f517622f79c33cce2c5c378c67eb598e471df70a6192d64b6927193f43880f4/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f4c616e736f7765622f75716c2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/Lansoweb/uql?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/9e84ffb51b3d56d233a846d86306d8c26a54d9b2ee2d02cd0753fc2ac2184d25/68747470733a2f2f706f7365722e707567782e6f72672f6c6f732f75716c2f762f737461626c65)](https://packagist.org/packages/los/uql)[![Total Downloads](https://camo.githubusercontent.com/215ada7ed8ddaad8377ddc5fb740e17a7591ca01ad3c29e58bda524cf46bc81a/68747470733a2f2f706f7365722e707567782e6f72672f6c6f732f75716c2f646f776e6c6f616473)](https://packagist.org/packages/los/uql)[![License](https://camo.githubusercontent.com/af5917110f04191d15b72c6012d3683126154e6535f7d8c1fda4fe36c2f5f198/68747470733a2f2f706f7365722e707567782e6f72672f6c6f732f75716c2f6c6963656e7365)](https://packagist.org/packages/los/uql)

This library utilizes url query parameters and generates db queries.

At this moment, it provides integration with:

- [zend-db](https://github.com/laminas/laminas-db/)

Planned:

- [mongodb](https://docs.mongodb.com/php-library/current/)

Installing
----------

[](#installing)

```
 composer require los/uql
```

Usage
-----

[](#usage)

The builder uses the query parameters 'q' for the queries and 'h' for hint (sort, order, limits, etc). You can change these in the constructor:

```
$builder = new ZendDbBuilder($select, 'query', 'hint');
```

The Select instance returned by the builder methods is a clone from the one passed in the constructor.

### Zend DB

[](#zend-db)

Passing the request directly:

```
public function handle(ServerRequestInterface $request): ResponseInterface
{
    $select = new \Laminas\Db\Select('table');
    $select = (new ZendDbBuilder($select))->fromRequest($request);
    $statement = $sql->prepareStatementForSqlObject($select);
    $results = $statement->execute();
}
```

or manually passing the parameters:

```
public function handle(ServerRequestInterface $request): ResponseInterface
{
    $queryParams = $request->getQueryParams();
    $query = $queryParams['q'] ?? [];
    $hint = $queryParams['h'] ?? [];

    $select = new \Laminas\Db\Select('table');
    $select = (new ZendDbBuilder($select))->fromParams($query, $hint);
    $statement = $sql->prepareStatementForSqlObject($select);
    $results = $statement->execute();
}
```

#### Examples:

[](#examples)

operationurl queryselectequal?q={"id":1}WHERE id = 1not?q={"id":{"$not":1}}WHERE id != 1in?q={"id":{"$in":\[1,2\]}}WHERE id IN (1, 2)nin?q={"id":{"$nin":\[1,2\]}}WHERE id NOT IN (1, 2)like?q={"name":{"$like":"John%"}}WHERE name LIKE 'John%'null?q={"$null":"name"}WHERE name IS NULLnot null?q={"$nnull":"name"}WHERE name IS NOT NULLand?q={"$and":\[{"id":1},{"name":"John"}\]}WHERE id = 1 AND name = 'John'or?q={"$or":\[{"id":1},{"name":"John"}\]}WHERE id = 1 OR name = 'John'greater?q={"price":{"$gt":100}}WHERE price &gt; 100greater or equal?q={"price":{"$gte":100}}WHERE price &gt;= 100less?q={"price":{"$lt":100}}WHERE price &lt; 100less or equal?q={"price":{"$lte":100}}WHERE price &lt;= 100between?q={"price":{"$bt":\[100,200\]}}WHERE price &gt;= 100 AND price &lt;= 200You can mix and nest queries:

url queryselect?q={"id":{"$not":1},"$or":\[{"id":2},{"id":"3"}\],"$and":\[{"id":2},{"name":"test"}\]}WHERE "id" != '1' AND ("id" = '2' OR "id" = '3') AND ("id" = '2' AND "name" = 'test')?q={"$or":\[{"$and":\[{"id":1},{"name":"test"}\]},{"id":{"$not":1}},{"name":"test"}\]}WHERE (("id" = '1' AND "name" = 'test') OR "id" != '1' OR "name" = 'test')#### Hint examples:

[](#hint-examples)

operationurl queryselectsort?q={"id":1}&amp;h={"$sort":"name"}WHERE id = 1 ORDER BY name asc, price DESCsort?q={"id":1}&amp;h={"$sort":{"name":"asc","price":-1}}WHERE id = 1 ORDER BY name asc, price DESClimit?q={}&amp;h={"$limit":10}SELECT \* FROM table LIMIT 10limit + skip?q={}&amp;h={"$limit":10,"$skip":20}SELECT \* FROM table LIMIT 10 SKIP 10

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.2% 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 ~135 days

Total

2

Last Release

836d ago

PHP version history (2 changes)1.3.x-devPHP ^8.1

1.0.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/9155a672b863ca2243f6b3d69d61d55bf35ae8e421c1b4f1655293a34d0451ba?d=identicon)[talbuquerque](/maintainers/talbuquerque)

---

Top Contributors

[![Lansoweb](https://avatars.githubusercontent.com/u/2109813?v=4)](https://github.com/Lansoweb "Lansoweb (25 commits)")[![talbuquerque](https://avatars.githubusercontent.com/u/20418669?v=4)](https://github.com/talbuquerque "talbuquerque (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/zooxsmart-los-uql/health.svg)

```
[![Health](https://phpackages.com/badges/zooxsmart-los-uql/health.svg)](https://phpackages.com/packages/zooxsmart-los-uql)
```

###  Alternatives

[kreait/firebase-php

Firebase Admin SDK

2.4k39.7M72](/packages/kreait-firebase-php)[phpmyadmin/phpmyadmin

A web interface for MySQL and MariaDB

15378.5k4](/packages/phpmyadmin-phpmyadmin)

PHPackages © 2026

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