PHPackages                             waxwink/clustering - 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. waxwink/clustering

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

waxwink/clustering
==================

Clustering map points with K-means or space dividing

0.9.3(7y ago)111MITPHP

Since Mar 9Pushed 7y agoCompare

[ Source](https://github.com/waxwink/clustering)[ Packagist](https://packagist.org/packages/waxwink/clustering)[ RSS](/packages/waxwink-clustering/feed)WikiDiscussions master Synced today

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

[![image_2019-03-10_09-19-21](https://user-images.githubusercontent.com/34881789/54081192-d5b08380-4315-11e9-8f78-bf913e8de23c.png)](https://user-images.githubusercontent.com/34881789/54081192-d5b08380-4315-11e9-8f78-bf913e8de23c.png)

Clustering
----------

[](#clustering)

This package focuses on clustering map markers in an efficient way by dividing the map in defined square spaces and assign each point to its own space.

### instruction

[](#instruction)

#### Getting Started

[](#getting-started)

Require the package in your project with the following command with composer:

```
$ composer require waxwink/clustering

```

#### Usage

[](#usage)

The usage is pretty straight forward:

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

use Waxwink\Clustering\Clustering;

$points = [
	[
		'lat' => 35.821006,
		'lng' => 51.427388
	],
	[
		'lat' => 35.716912,
		'lng' => 51.439202
	],
	[
		'lat' => 35.67787,
		'lng' => 51.358735
	],
	[
		'lat' => 35.743621,
		'lng' => 51.530846
	],
];
```

For dividing the space into equal areas and cluster the points by the spaces you can use the following format:

```
$output = Clustering::getClusters($points, 0.1);
//The second parameter is the length of the square spaces by which the points are going to be clusterd.
//output :
/*
array (size=3)
  0 =>
    array (size=3)
      'lat' => float 35.821006
      'lng' => float 51.427388
      'total' => int 1
  1 =>
    array (size=3)
      'lat' => float 35.697391
      'lng' => float 51.3989685
      'total' => int 2
  2 =>
    array (size=3)
      'lat' => float 35.743621
      'lng' => float 51.530846
      'total' => int 1
*/
```

Another option for clustering is the K-means algorithm in which the number of requested clusters is required. This approach is slower in performance but gives accurate clusters.

```
$output = Clustering::getClusters($points, 2, Clustering::K_MEANS_ALGORITHM, 5);
//the second parameter is the number of clusters
//the third parameter is the algorithm
//the forth parameter is the number of iterations used in the K-means algorithm which is 5 by default

//output:
/*
array (size=2)
  0 =>
    array (size=3)
      'lat' => float 35.821006
      'lng' => float 51.427388
      'total' => int 1
  1 =>
    array (size=3)
      'lat' => float 35.712801
      'lng' => float 51.442927666667
      'total' => int 3
*/
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

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

Total

4

Last Release

2589d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/691322b900db6b86519a6d891a39ea59824fc8cb95330303933c81be13a8dbb2?d=identicon)[mohamadreza89](/maintainers/mohamadreza89)

---

Top Contributors

[![mohamadrezapishdad](https://avatars.githubusercontent.com/u/34881789?v=4)](https://github.com/mohamadrezapishdad "mohamadrezapishdad (10 commits)")

### Embed Badge

![Health badge](/badges/waxwink-clustering/health.svg)

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

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M686](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[efureev/laravel-trees

Multi-Tree structures for Laravel

14253.3k4](/packages/efureev-laravel-trees)[illuminatech/balance

Provides support for Balance accounting system based on debit and credit principle

16137.4k](/packages/illuminatech-balance)[zonneplan/laravel-module-loader

Module loader for Laravel

24118.4k](/packages/zonneplan-laravel-module-loader)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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