PHPackages                             crimson-nynja/php-trees - 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. crimson-nynja/php-trees

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

crimson-nynja/php-trees
=======================

PHP implementation of various Trees

0.6.0(4y ago)181GPL-3.0-or-laterPHPPHP &gt;=8.1.0CI failing

Since Nov 20Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/CrimsonNynja/PHP-Trees)[ Packagist](https://packagist.org/packages/crimson-nynja/php-trees)[ RSS](/packages/crimson-nynja-php-trees/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (10)Dependencies (1)Versions (14)Used By (0)

PHP-Trees
=========

[](#php-trees)

[![GitHub Workflow build status badge](https://github.com/CrimsonNynja/PHP-Trees/workflows/Unit%20Tests/badge.svg)](https://github.com/CrimsonNynja/PHP-Trees/workflows/Unit%20Tests/badge.svg) [![Latest Stable Version](https://camo.githubusercontent.com/7efb63d0f8093ec4ff724e7ec5fb630929503c54560673f930a8d61d14e9e96e/68747470733a2f2f706f7365722e707567782e6f72672f6372696d736f6e2d6e796e6a612f7068702d74726565732f762f737461626c65)](https://packagist.org/packages/crimson-nynja/php-trees)

This repo is designed to have all common trees used in an easy to use php way

Current included are implementations of a Binary Search Tree, Rope, Binary Heap, and a Generic Tree, with more to come!

All tests are written in PHP Unit, and all code is written in the PSR-4 standards. Php Trees also requires PHP 8.1.0 or above, and utilizes all modern features of PHP.

PHP Trees can be installed through composer with

```
composer require crimson-nynja/php-trees
```

Usage
-----

[](#usage)

To use the binary search tree, include the correct file and create it as such

```
use PhpTrees\BinarySearchTree;

$b = new BinarySearchTree(rootValue: 5);
// This will create a binary search tree with a root of the value 5
```

To use the Rope

```
use PhpTrees\Rope;

$r = new Rope(string: "This is a Rope!");
// This will create a Rope with the initial string, "This is a Rope!"
```

To use the Binary Heap

```
use PhpTrees\BinaryHeap;

$h = new BinaryHeap();
// This will create an empty binary heap
```

To use the Generic Tree

```
use PhpTrees\GenericTree;

$g = new GenericTree(rootValue: 4.1);
// This will create a generic tree with root 4.1
```

For a more detailed description of the features of PHP Trees, check out the wiki

Coming up
---------

[](#coming-up)

tree balancing options
2-3 tree
B-Tree
search/traversal types (depth first search breadth first search, etc)

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance48

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 95.5% 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 ~70 days

Recently: every ~167 days

Total

12

Last Release

1601d ago

PHP version history (4 changes)v0.1PHP &gt;=7.2.0

0.3PHP &gt;=7.4.0

0.5.0PHP &gt;=8.0.0

0.6.0PHP &gt;=8.1.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7157784?v=4)[Hudson Cassidy](/maintainers/CrimsonNynja)[@CrimsonNynja](https://github.com/CrimsonNynja)

---

Top Contributors

[![CrimsonNynja](https://avatars.githubusercontent.com/u/7157784?v=4)](https://github.com/CrimsonNynja "CrimsonNynja (106 commits)")[![andrewmy](https://avatars.githubusercontent.com/u/715595?v=4)](https://github.com/andrewmy "andrewmy (5 commits)")

---

Tags

binary-heapbinary-search-treebinaryheapbinaryheap-arraybstgeneric-treephpphp8roperope-stringtreetreesphptreeheapbinary heapphp-8treesbstBinary Search TreeRopeGeneric Tree

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/crimson-nynja-php-trees/health.svg)

```
[![Health](https://phpackages.com/badges/crimson-nynja-php-trees/health.svg)](https://phpackages.com/packages/crimson-nynja-php-trees)
```

###  Alternatives

[loophp/phptree

An implementation of tree data structure

981.8M2](/packages/loophp-phptree)[efureev/laravel-trees

Multi-Tree structures for Laravel

14253.3k4](/packages/efureev-laravel-trees)

PHPackages © 2026

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