PHPackages                             oliva/tree - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. oliva/tree

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

oliva/tree
==========

Utility for handling tree data structures and building trees from flat data stored in database tables and alike.

1.4.1(1y ago)330.2k↓69.9%3UnlicensePHPPHP ^8.0 || ^7.4

Since Jun 30Pushed 1y ago1 watchersCompare

[ Source](https://github.com/dakujem/oliva-tree)[ Packagist](https://packagist.org/packages/oliva/tree)[ RSS](/packages/oliva-tree/feed)WikiDiscussions trunk Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (30)Used By (0)

> 📢
>
> It's been a long time since the dawn of this library. It still runs on modern PHP, but it's far from optimal.
>
> See a modern reimplementation of this library here: [👉 `dakujem/oliva`](https://github.com/dakujem/oliva)

Oliva Tree
==========

[](#oliva-tree)

[![PHP from Packagist](https://camo.githubusercontent.com/c848b51c904c8e5bc48de358fa5750b77efc5940d28787648781d1511f61572c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6f6c6976612f74726565)](https://packagist.org/packages/oliva/tree)[![Tests](https://github.com/dakujem/oliva-tree/actions/workflows/php-test.yml/badge.svg)](https://github.com/dakujem/oliva-tree/actions/workflows/php-test.yml)[![Coverage Status](https://camo.githubusercontent.com/fb47b02392de93576c152ef14ed58f25802988467a906c456a74f6efff55c497/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f64616b756a656d2f6f6c6976612d747265652f62616467652e7376673f6272616e63683d7472756e6b)](https://coveralls.io/github/dakujem/oliva-tree?branch=trunk)

Utility for handling tree data structures.

> 💿 `composer require oliva/tree`
>
> 📖 **[documentation](doc/docs.md)**

**Oliva Tree** is a powerful yet simple to use utility for handling tree data structures in PHP.

Useful for handling **tree data stored in database** or for performing **search** and **filter** operations on arbitrary tree structures.

Why use Oliva Tree?
-------------------

[](#why-use-oliva-tree)

- data manipulation
- write components like **menus**, **tree views**, **grids**, **data lists**, etc. with ease.
- [it's documented](doc/docs.md)
- battle and unit tested

### What can you do with Oliva Tree?

[](#what-can-you-do-with-oliva-tree)

- **build** tree structures **from arbitrary flat data** with support for
    - materialized path data model
    - recursive trees (parent - id) (adjacency list data model, self-joined tables)
    - build trees **from JSON** strings
- build trees using a fluent interface
- seamlessly wrap objects with `Node` class and keep using them as before
- enhance functionality of data already in tree structures
- **find nodes**, breadth-first or depth-first
- **filter nodes** by any condition
- **compare trees**, nodes, sub-trees
- provide means for **easy** tree structure **manipulation**
- **transform** tree structures (back) to flat data, in breadth-first or depth-first manner

Documentation
-------------

[](#documentation)

For more in-depth information, use cases and other examples, see the **[documentation section](doc/docs.md)**.

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

[](#installation)

`composer require oliva/tree`

Older versions of Oliva Tree run on PHP 5.4 and up and also PHP 7.0 and up. Versions since `1.3` support PHP 7.4+ and PHP 8+ (including PHP 8.2 and PHP 8.3).

Changelog
---------

[](#changelog)

> Notable changes only.

**1.4**

- PHP 8.1+ supported
- some return type-hints added

**1.3**

- PHP 8.0 support added
- PHP &gt;= 7.4 required
- updated to a simple permissive license (Unlicense)

**1.2.3**

- updated licensing to enable multi-licensing, i.e. one can now use any of GPL, MIT or BSD license, see [license.md](license.md) for more information

Missing features
----------------

[](#missing-features)

I never added these...

- prunning (condition- and depth-based)
- node moving mechanism / helpers
- tree writers - alter the node's data to reflect current tree structure (prepare for storage) - a counterpart to tree builders
- unite and document exception codes
- support for nested sets data model

> On the second thought, most of these things are outside the scope of this library anyway.

Notes
-----

[](#notes)

Great thank's to folks in [**Via Aurea**](https://github.com/viaaurea) for providing valuable support, motivation and real-world testing.

> 🎉
>
> I finally found a reason to reimplement the idea of this tool for building and managing trees.
>
> See the modern reimplementation here: [👉 `dakujem/oliva`](https://github.com/dakujem/oliva)

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance41

Moderate activity, may be stable

Popularity33

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity79

Established project with proven stability

 Bus Factor1

Top contributor holds 97.8% 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 ~133 days

Recently: every ~769 days

Total

27

Last Release

498d ago

Major Versions

0.6.0 → 1.0.02015-08-20

PHP version history (3 changes)0.1.0PHP &gt;=5.6.0

1.2.1PHP ^5.4 || ^7.0

1.3PHP ^8.0 || ^7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/0bd7fa945013e9c0dcd65693575276bf5fcb9b9de13e1123e9f2c4a0a4c0fb6b?d=identicon)[dakujem](/maintainers/dakujem)

---

Top Contributors

[![dakujem](https://avatars.githubusercontent.com/u/443067?v=4)](https://github.com/dakujem "dakujem (136 commits)")[![xr](https://avatars.githubusercontent.com/u/6114473?v=4)](https://github.com/xr "xr (2 commits)")[![adrenalinkin](https://avatars.githubusercontent.com/u/4967813?v=4)](https://github.com/adrenalinkin "adrenalinkin (1 commits)")

---

Tags

utilitytreeutilitiesdata structures

### Embed Badge

![Health badge](/badges/oliva-tree/health.svg)

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

###  Alternatives

[nette/utils

🛠 Nette Utils: lightweight utilities for string &amp; array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.

2.1k394.3M1.5k](/packages/nette-utils)[vaimo/composer-patches

Applies a patch from a local or remote file to any package that is part of a given composer project. Patches can be defined both on project and on package level. Optional support for patch versioning, sequencing, custom patch applier configuration and patch command for testing/troubleshooting added patches.

2994.3M14](/packages/vaimo-composer-patches)[lodash-php/lodash-php

A port of Lodash to PHP

527719.0k5](/packages/lodash-php-lodash-php)[phpcsstandards/phpcsutils

A suite of utility functions for use with PHP\_CodeSniffer

6233.4M58](/packages/phpcsstandards-phpcsutils)

PHPackages © 2026

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