PHPackages                             widi/nearestneighbor - 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. widi/nearestneighbor

ActiveLibrary

widi/nearestneighbor
====================

Nearest neighbor feature set.

2.0.3(8y ago)07LGPL-3.0PHPPHP ^7.1

Since Jul 28Pushed 8y ago1 watchersCompare

[ Source](https://github.com/dirkwinkhaus/Widi-NearestNeighbor)[ Packagist](https://packagist.org/packages/widi/nearestneighbor)[ RSS](/packages/widi-nearestneighbor/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

Widi-NearestNeighbor Feature Set
================================

[](#widi-nearestneighbor-feature-set)

Sample of usage
---------------

[](#sample-of-usage)

```
use Widi\NearestNeighbor\Vector;
use Widi\NearestNeighbor\Factory\VectorFactory;

$vectorATwoDimensions = new Vector(11,2);
$vectorBTwoDimensions = new Vector(4,5);
$vectorAThreeDimensions = new Vector(1,5,10);

// this will return true
$vectorATwoDimensions->isCompatible($vectorBTwoDimensions);
// this will return false
$vectorATwoDimensions->isCompatible($vectorThreeDimensions);

// returns 2
$vectorATwoDimensions->getDimensionCount();
// returns 3
$vectorAThreeDimensions->getDimensionCount();

// this should return 7.615773
$vectorATwoDimensions->calculateDistanceTo($vectorBTwoDimensions);

// with factory
$factory = new VectorFactory();
$vector = $factory->create(1,2,3);

// find nearest neighbor
$vectorA = new Vector(0,0);
$vectorB = new Vector(1,1);
$vectorC = new Vector(2,2);

$collection = new VectorCollection(
    $vectorA,
    $vectorB,
    $vectorC
);

// this will return the instance of $vectorA
$collection->findClosest(new Vector(0.1,0.1));

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

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

Total

2

Last Release

3208d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/dcaf8b473dd3b2142146da63979e16054195ab77bc214043675e7bb210d4d4a0?d=identicon)[widi](/maintainers/widi)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/widi-nearestneighbor/health.svg)

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

PHPackages © 2026

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