PHPackages                             michalsanger/quadtree - 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. michalsanger/quadtree

ActiveLibrary

michalsanger/quadtree
=====================

An easy-to-modify Quadtree with standard 2D implementation.

v0.7.0(11y ago)1821MITPHPPHP &gt;=5.3.3

Since Oct 4Pushed 11y agoCompare

[ Source](https://github.com/michalsanger/php-quadtree)[ Packagist](https://packagist.org/packages/michalsanger/quadtree)[ RSS](/packages/michalsanger-quadtree/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (4)Dependencies (1)Versions (5)Used By (0)

Quadtree [![Build Status](https://camo.githubusercontent.com/83ec544e0cdd0660595f954c19d154457f81800f2de79c99cb1fe4b5b890fca7/68747470733a2f2f7472617669732d63692e6f72672f6d696368616c73616e6765722f7068702d71756164747265652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/michalsanger/php-quadtree)
===================================================================================================================================================================================================================================================================================================================

[](#quadtree-)

An easy-to-modify [Quadtree](http://en.wikipedia.org/wiki/Quadtree) with standard 2D implementation.

Usage
-----

[](#usage)

Standard 2D collision detection supports points and bounds (rectangular regions):

```
use \Quadtree\Quadtree;
use \Quadtree\Geometry\Bounds;
use \Quadtree\Geometry\Point;

$qtBounds = new Bounds(1024, 1024);
$qt = new Quadtree($qtBounds);

$qt->insert(new Bounds(300, 200)); // TRUE
$qt->insert(new Bounds(100, 50, 20, 10)); // FALSE
$qt->insert(new Point(250, 100)); // FALSE
$qt->insert(new Point(2000, 500)); // FALSE
$qt->insert(new Point(299, 199)); // TRUE
```

Need more logic for collision detection? Create your own [`ICollisionDetector`](https://github.com/michalsanger/php-quadtree/blob/master/Quadtree/ICollisionDetector.php). Need to insert other objects then points and bounds? Implement [`Insertable`](https://github.com/michalsanger/php-quadtree/blob/master/Quadtree/Insertable.php) interface.

API
---

[](#api)

[See the docs](http://michalsanger.github.io/php-quadtree/api/)

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

[](#installation)

Use Composer:

```
composer require michalsanger/quadtree

```

Tests
-----

[](#tests)

Due to [Nette Tester](https://github.com/nette/tester/) tests are simple and readable. Run:

```
> vendor/bin/tester tests/

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

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

Total

4

Last Release

4219d ago

PHP version history (2 changes)v0.0.1PHP &gt;=5.3.0

v0.6.0PHP &gt;=5.3.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/1672f224a65e84e3dc99ee449b02542380763d69dc9e929e1923d7e54fc7a246?d=identicon)[michalsanger](/maintainers/michalsanger)

---

Top Contributors

[![michalsanger](https://avatars.githubusercontent.com/u/2528846?v=4)](https://github.com/michalsanger "michalsanger (57 commits)")

---

Tags

quadtreecollision detection

### Embed Badge

![Health badge](/badges/michalsanger-quadtree/health.svg)

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

###  Alternatives

[markbaker/quadtrees

QuadTree implementation in PHP

1739.2k](/packages/markbaker-quadtrees)

PHPackages © 2026

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