PHPackages                             p4bgroup/phalcon-nested-sets - 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. p4bgroup/phalcon-nested-sets

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

p4bgroup/phalcon-nested-sets
============================

Phalcon Nested Set Models. Nested set models for Phalcon Framework

1.0.6(6y ago)21.5k2MITPHPPHP &gt;= 7.2CI failing

Since Nov 24Pushed 6y ago4 watchersCompare

[ Source](https://github.com/P4BGroup/phalcon-nested-sets)[ Packagist](https://packagist.org/packages/p4bgroup/phalcon-nested-sets)[ RSS](/packages/p4bgroup-phalcon-nested-sets/feed)WikiDiscussions master Synced today

READMEChangelog (6)Dependencies (5)Versions (7)Used By (0)

Nested Set Behaviour
--------------------

[](#nested-set-behaviour)

Phalcon implementation for tree / hierarchy through nested sets implementation. It will calculate edges and depth for a category on creation, update and delete.

Moving "branches" is not supported (o sub-node with all it's sub-nodes) and won't be. This tool is meant to "react" to changes on a single record and keep the rest of the tree position in place.

prerequisites
-------------

[](#prerequisites)

Your DB must have parent, left, right, depth columns. Example:

```
CREATE TABLE `categories` (
	`id` INT(11) NOT NULL AUTO_INCREMENT,
	`name` CHAR(50) NULL DEFAULT NULL,
	`parent_id` INT(11) NULL DEFAULT NULL,
	`_left` INT(11) NULL DEFAULT NULL,
	`_right` INT(11) NULL DEFAULT NULL,
	`_depth` INT(11) NULL DEFAULT NULL,
	PRIMARY KEY (`id`)
);
```

usage
-----

[](#usage)

```
class MyModel extends \Phalcon\Mvc\Model {
    public function initialize() {
        $this->addBehaviour(new \P4BGroup\NestedSets\Behaviour());
    }
}
```

references
----------

[](#references)

- [https://en.wikipedia.org/wiki/Nested\_set\_model](https://en.wikipedia.org/wiki/Nested_set_model)
-
-

usage
-----

[](#usage-1)

this behaviour will automatically calculate the edges and depth of each node on save / delete

Similar implementations on other frameworks
-------------------------------------------

[](#similar-implementations-on-other-frameworks)

-  - laravel
-  - laravel
-  - doctrine
-  - zend / pdo
-  - yii

###  Health Score

31

—

LowBetter than 65% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

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

Total

6

Last Release

2407d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/13b6b73a69c16b06d2fc6296529526423796dc1098acc0155edd54f17a54e909?d=identicon)[cfv1000](/maintainers/cfv1000)

---

Tags

behaviournested-setsphalconphalcon-frameworktreemysqlsqlitepdomssqltreephalconhierarchynested-set

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/p4bgroup-phalcon-nested-sets/health.svg)

```
[![Health](https://phpackages.com/badges/p4bgroup-phalcon-nested-sets/health.svg)](https://phpackages.com/packages/p4bgroup-phalcon-nested-sets)
```

###  Alternatives

[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k614.3M7.4k](/packages/doctrine-dbal)[nette/database

💾 Nette Database: layer with a familiar PDO-like API but much more powerful. Building queries, advanced joins, drivers for MySQL, PostgreSQL, SQLite, MS SQL Server and Oracle.

5437.0M271](/packages/nette-database)[dibi/dibi

Dibi is Database Abstraction Library for PHP

5014.1M138](/packages/dibi-dibi)[ezsql/ezsql

Advance database access library. Make interacting with a database ridiculously easy. An universal interchangeable CRUD system.

86849.9k](/packages/ezsql-ezsql)[jv2222/ezsql

Advance database access library. Make interacting with a database ridiculously easy. An universal interchangeable CRUD system.

86711.7k2](/packages/jv2222-ezsql)[tommyknocker/pdo-database-class

Framework-agnostic PHP database library with unified API for MySQL, MariaDB, PostgreSQL, SQLite, MSSQL, and Oracle. Query Builder, caching, sharding, window functions, CTEs, JSON, migrations, ActiveRecord, CLI tools, AI-powered analysis. Zero external dependencies.

856.1k](/packages/tommyknocker-pdo-database-class)

PHPackages © 2026

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