PHP library for handling tree structures

Version 3.0 (03/28/2019)
Price: Free / Donations

Tree is a PHP library for handling data that is structured hierarchically using parent ID references. A typical example is a table in a database where each record (or rather document, when talking about document databases) has a “parent” field which references the unique ID of another record. Of course, the library cannot only use data originating from a database, but anything: you supply the data, and Tree uses it, regardless of where the data came from and how it was processed.

It is important to know that the tree structure created by this package is read-only: you can’t use it to perform modifications of the tree nodes. If you need a library for that, you will probably want something else.

On the other hand, one nice thing is that it’s pretty fast. This does not only mean the code itself, but also that the constructor takes the input data in a format that is simple to create. For instance, to create a tree from database content, a single SELECT is sufficient, regardless of the depth of the tree and even for thousands of nodes.

Back to list of projects