PHPackages                             markbaker/quadtrees - 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. markbaker/quadtrees

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

markbaker/quadtrees
===================

QuadTree implementation in PHP

2.2.2(7y ago)1739.2k↓34.4%7[1 issues](https://github.com/MarkBaker/QuadTrees/issues)MITPHPPHP ^7.0.0

Since Jan 25Pushed 7y ago3 watchersCompare

[ Source](https://github.com/MarkBaker/QuadTrees)[ Packagist](https://packagist.org/packages/markbaker/quadtrees)[ Docs](https://github.com/MarkBaker/QuadTrees)[ RSS](/packages/markbaker-quadtrees/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (8)Versions (10)Used By (0)

QuadTrees
=========

[](#quadtrees)

A PHP implementation of the QuadTree data structure

Master: [![Build Status](https://camo.githubusercontent.com/2110465fa5ab592085920ef13a81508207bac3becbbd8613b38caf4e699001ca/68747470733a2f2f7472617669732d63692e6f72672f4d61726b42616b65722f5175616454726565732e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/MarkBaker/QuadTrees)

Develop: [![Build Status](https://camo.githubusercontent.com/023e9ed509a3032f7f929a2027f2fde60a4a284d7ebe6b2aa23b27457d4338c6/68747470733a2f2f7472617669732d63692e6f72672f4d61726b42616b65722f5175616454726565732e706e673f6272616e63683d646576656c6f70)](http://travis-ci.org/MarkBaker/QuadTrees)

Requirements
------------

[](#requirements)

- PHP version 7.0.0 or higher

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

[](#installation)

We recommend installing this package with [Composer](https://getcomposer.org/ "Get Composer").

### Via composer

[](#via-composer)

In your project root folder, execute

```
composer require markbaker/quadtrees:dev-master

```

You should now have the files `composer.json` and `composer.lock` as well as the directory `vendor` in your project directory.

You can then require the Composer autoloader from your code

```
require 'vendor/autoload.php';

```

Or, if you already have a composer.json file, then require this package in that file

```
"require": {
    "markbaker/quadtrees": "dev-master"
}

```

and update composer.

```
composer update

```

### From Phar

[](#from-phar)

Although we strongly recommend using Composer, we also provide a [Phar archive](http://php.net/manual/en/book.phar.php "Read about Phar") builder that will create a Phar file containing all of the library code.

The phar builder script is in the repository root folder, and can be run using

```
php buildPhar.php

```

To use the archive, just require it from your script:

```
require 'QuadTrees.phar';

```

### Standard Autoloader

[](#standard-autoloader)

If you want to run the code without using composer's autoloader, and don't want to build the phar, then required the `bootstrap.php` file from the repository in your code, and this will enable the autoloader for the library.

```
require 'bootstrap.php';

```

Want to contribute?
-------------------

[](#want-to-contribute)

Fork this library!

License
-------

[](#license)

QuadTrees is licensed under an [MIT LICENSE)](https://github.com/MarkBaker/Quadtrees/blob/master/license.md)

Examples
--------

[](#examples)

The /examples folder contains a couple of examples to demonstrate its use:

- citySearch.php

    allows a search on a defined bounding box, and will display a list of cities that fall within that bounding box

    usage:

    ```
     php citySearch.php

     latitude   Latitude of the centre point of the bounding box
                  (as a floating-point value in degrees, positive values
                  for East, negative for West)
     longitude  Longitude of the centre point of the bounding box
                  (as a floating-point value in degrees, positive values
                  for North, negative for South)
     width      Width of the bounding box
                  (as a floating-point value in degrees)
     height     Height of the bounding box
                  (as a floating-point value in degrees)

    ```

Data for the list of cities is from [geonames.org](http://www.geonames.org/ "Geonames"), licensed under a [Creative Commons Attribution 3.0 License](http://creativecommons.org/licenses/by/3.0/ "Creative Commons Attribution License 3.0"), and provided "as is" without warranty or any representation of accuracy, timeliness or completeness.

- lunarLandingSearch.php

    allows a search on a defined bounding box, and will display a list of moon landings that fall within that bounding box

    usage:

    ```
     php lunarLandingSearch.php

     latitude   Latitude of the centre point of the bounding box
                  (as a floating-point value in degrees, positive values
                  for East, negative for West)
     longitude  Longitude of the centre point of the bounding box
                  (as a floating-point value in degrees, positive values
                  for North, negative for South)
     width      Width of the bounding box
                  (as a floating-point value in degrees)
     height     Height of the bounding box
                  (as a floating-point value in degrees)

    ```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity38

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

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

Recently: every ~2 days

Total

8

Last Release

2746d ago

Major Versions

1.0.0 → 2.0.02018-11-02

PHP version history (2 changes)1.0.0PHP &gt;=5.3.0

2.0.0PHP ^7.0.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/2b8457fa3227a7e8e38f0121f1fe254ec965133df93ae5ea8352c757adb98283?d=identicon)[PHPOffice](/maintainers/PHPOffice)

---

Top Contributors

[![fire015](https://avatars.githubusercontent.com/u/501743?v=4)](https://github.com/fire015 "fire015 (1 commits)")

---

Tags

indexgisgeospatialdatastructurequadtree

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/markbaker-quadtrees/health.svg)

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

###  Alternatives

[symfony/property-access

Provides functions to read and write from/to an object or array using a simple string notation

2.8k295.3M2.5k](/packages/symfony-property-access)[mjaschen/phpgeo

Simple Yet Powerful Geo Library

1.6k8.6M22](/packages/mjaschen-phpgeo)[jmikola/geojson

GeoJSON implementation for PHP

3109.0M77](/packages/jmikola-geojson)[spatie/laravel-robots-middleware

Add an `all` or `none` robots header to your requests via a middleware in Laravel

3352.1M5](/packages/spatie-laravel-robots-middleware)[brick/geo

GIS geometry library

245862.1k15](/packages/brick-geo)[phpmyadmin/shapefile

ESRI ShapeFile library for PHP

281.4M1](/packages/phpmyadmin-shapefile)

PHPackages © 2026

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