PHPackages                             smoren/query-relation-manager - 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. smoren/query-relation-manager

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

smoren/query-relation-manager
=============================

Class for building queries and making result array with relations (single and multiple)

v3.0.0(3y ago)438311MITPHPPHP &gt;=7.4

Since Aug 28Pushed 3y ago2 watchersCompare

[ Source](https://github.com/Smoren/query-relation-manager-php)[ Packagist](https://packagist.org/packages/smoren/query-relation-manager)[ RSS](/packages/smoren-query-relation-manager/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (8)Dependencies (5)Versions (9)Used By (1)

query-relation-manager
======================

[](#query-relation-manager)

[![Packagist PHP Version Support](https://camo.githubusercontent.com/4eb9d986ed75e32fc48a00e660006db64afc7e9d151e38e925c7445c5b788f9b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f736d6f72656e2f71756572792d72656c6174696f6e2d6d616e61676572)](https://camo.githubusercontent.com/4eb9d986ed75e32fc48a00e660006db64afc7e9d151e38e925c7445c5b788f9b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f736d6f72656e2f71756572792d72656c6174696f6e2d6d616e61676572)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/f07bf6efc097889abf9297031525540a1f9ed8815a0ceeac0de189b51f917ab4/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f536d6f72656e2f71756572792d72656c6174696f6e2d6d616e616765722d7068702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Smoren/query-relation-manager-php/?branch=master)[![Coverage Status](https://camo.githubusercontent.com/10d871a4942f7484d9d8041efde7628e7f0e37b68c550dc48a0a72c09654cfd9/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f536d6f72656e2f71756572792d72656c6174696f6e2d6d616e616765722d7068702f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/Smoren/query-relation-manager-php?branch=master)[![Build and test](https://github.com/Smoren/query-relation-manager-php/actions/workflows/test_master.yml/badge.svg)](https://github.com/Smoren/query-relation-manager-php/actions/workflows/test_master.yml/badge.svg)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)

Implements the functionality of getting tree data from a database with one-to-one and one-to-many relationships using only one select-query to the database with flexible conditions configuration.

**QueryRelationManager** can be integrated with any ORM system based on PHP and potentially compatible with any relational DBMS.

Current package includes an example of integration with raw PDO without ORM.

Also there is an implementation for **ActiveRecord** as [extension for **Yii2**](https://github.com/Smoren/yii2-query-relation-manager).

### How to install to your project

[](#how-to-install-to-your-project)

```
composer require smoren/query-relation-manager

```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity60

Established project with proven stability

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

Recently: every ~182 days

Total

8

Last Release

1355d ago

Major Versions

1.0.1 → 2.0.02020-08-31

2.0.4 → v3.0.02022-09-01

PHP version history (2 changes)1.0.0PHP &gt;=7.2.0

v3.0.0PHP &gt;=7.4

### Community

Maintainers

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

---

Top Contributors

[![Smoren](https://avatars.githubusercontent.com/u/7403235?v=4)](https://github.com/Smoren "Smoren (22 commits)")

---

Tags

ormphp-librarysqlsqlquerybuildertreetree-buildertree-structureormquerybuilderactiverecordrelation

###  Code Quality

TestsCodeception

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/smoren-query-relation-manager/health.svg)

```
[![Health](https://phpackages.com/badges/smoren-query-relation-manager/health.svg)](https://phpackages.com/packages/smoren-query-relation-manager)
```

###  Alternatives

[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)[envms/fluentpdo

FluentPDO is a quick and light PHP library for rapid query building. It features a smart join builder, which automatically creates table joins.

925511.7k13](/packages/envms-fluentpdo)[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)[biiiiiigmonster/hasin

Laravel framework relation has in implement

154552.4k](/packages/biiiiiigmonster-hasin)[bephp/activerecord

micro activerecord library in PHP(only 400 lines with comments), support chain calls and relations(HAS\_ONE, HAS\_MANY, BELONGS\_TO).

1202.1k2](/packages/bephp-activerecord)

PHPackages © 2026

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