PHPackages                             nullform/fuzzio - 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. [Search &amp; Filtering](/categories/search)
4. /
5. nullform/fuzzio

ActiveLibrary[Search &amp; Filtering](/categories/search)

nullform/fuzzio
===============

Fuzzy search using similar\_text() and levenshtein() functions. Easy to use and safe for multibyte encodings (UTF-8).

v1.1.4(2y ago)3683MITPHPPHP &gt;=5.6

Since Mar 1Pushed 1y ago1 watchersCompare

[ Source](https://github.com/nullform/fuzzio)[ Packagist](https://packagist.org/packages/nullform/fuzzio)[ Docs](https://github.com/nullform/fuzzio)[ RSS](/packages/nullform-fuzzio/feed)WikiDiscussions master Synced yesterday

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

Fuzzio
======

[](#fuzzio)

The PHP package for calculate similarity and Levenshtein distance between strings. Realizes fuzzy search using similar\_text() and levenshtein() functions. Easy to use and safe for multibyte encodings (UTF-8).

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

[](#requirements)

- PHP &gt;= 5.6

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

[](#installation)

```
composer require nullform/fuzzio
```

Usage examples
--------------

[](#usage-examples)

```
use \Nullform\Fuzzio\Fuzzio;
use \Nullform\Fuzzio\FuzzioString;

$needle = 'john'; // Reference string
$haystack = ['jon', 'johns', 'jane', 'janie']; // Array of strings

$fuzzio = new Fuzzio($needle, $haystack);

// Get all strings from $haystack with calculated similarity and Levenshtein distance
$all = $fuzzio->get(); // FuzzioString[]

// Get strings with similarity >= 80% and Levenshtein distance get(80, 1); // FuzzioString[]

// Get strings with Levenshtein distance get(null, 1); // FuzzioString[]

// With max similarity value
$allClosest = $fuzzio->getClosest(); // FuzzioString[]

// One (first) with max similarity value
$closestOne = $fuzzio->getClosestOne(); // FuzzioString

echo $closestOne; // johns
echo $closestOne->getString(); // johns
echo $closestOne->getSimilarity(); // 88.888888888889
echo $closestOne->getLevenshteinDistance(); // 1

echo $fuzzio->getMaxSimilarity(); // 88.888888888889

// Is there an exact match in the collection
$fuzzio->hasExactMatch(); // false

// Add string to haystack
$fuzzio->addToHaystack(['julie']);

// Remove strings from haystack
$fuzzio->removeFromHaystack(['janie', 'julie']);
```

You can set the similarity threshold and the Levenshtein distance threshold for filtering results:

```
use \Nullform\Fuzzio\Fuzzio;

$needle = 'john'; // Reference string
$haystack = ['jon', 'johns', 'jane', 'janie']; // Array of strings

$fuzzio = new Fuzzio($needle);

// Set max Levenshtein distance threshold
$fuzzio->setMaxLevenshteinDistanceThreshold(1);

// Set min similarity threshold
$fuzzio->setMinSimilarityThreshold(80);

// Set array of strings to calculate similarity
$fuzzio->setHaystack($haystack);

// Get strings with similarity >= 80% and Levenshtein distance get();
```

You can set a normalizer for more predictable calculations:

```
use \Nullform\Fuzzio\Fuzzio;

$needle = 'John'; // Reference string
$haystack = ['Jon ', 'Johns', 'JANE', 'Janie']; // Array of strings

$normalizer = function ($string) {
    return trim(strtolower($string));
};

$fuzzio = new Fuzzio($needle);

// Normalizer for $needle and $haystack
$fuzzio->setNormalizer($normalizer);
// Set array of strings to calculate similarity
$fuzzio->setHaystack($haystack);

// Or like this
$fuzzio = new Fuzzio($needle, $haystack, $normalizer);

echo $fuzzio->getNeedle(); // John
echo $fuzzio->getNormalizedNeedle(); // john

// One with max similarity
$closest = $fuzzio->getClosestOne();

echo $closest; // Johns
echo $closest->getString(); // Johns
echo $closest->getNormalizedString(); // johns
echo $closest->getSimilarity(); // 88.888888888889
echo $closest->getLevenshteinDistance(); // 1
```

Methods
-------

[](#methods)

### Fuzzio

[](#fuzzio-1)

- Fuzzio::**\_\_construct**(*string* $needle, *string\[\]|null* $haystack = *null*, *callable|null* $normalizer = null)
- Fuzzio::**getNeedle**(): *string*
- Fuzzio::**getNormalizedNeedle**(): *string*
- Fuzzio::**setHaystack**(*string\[\]* $haystack): *Fuzzio*
- Fuzzio::**getHaystack**(): *string\[\]*
- Fuzzio::**getNormalizedHaystack**(): *string\[\]*
- Fuzzio::**addToHaystack**(*string\[\]* $strings): *Fuzzio*
- Fuzzio::**removeFromHaystack**(*string\[\]* $strings): *Fuzzio*
- Fuzzio::**hasExactMatch()**: *bool*
- Fuzzio::**get**(*float|null* $minSimilarity = *null*, *int|null* $maxLevenshteinDistance = *null*): *FuzzioString\[\]*
- Fuzzio::**getClosest**(): *FuzzioString\[\]*
- Fuzzio::**getClosestOne**(): *FuzzioString*
- Fuzzio::**getMaxLevenshteinDistanceThreshold**(): *int|null*
- Fuzzio::**setMaxLevenshteinDistanceThreshold**(*int* $threshold): *Fuzzio*
- Fuzzio::**getMinSimilarityThreshold**(): *float|null*
- Fuzzio::**setMinSimilarityThreshold**(*float* $threshold): *Fuzzio*
- Fuzzio::**getMaxSimilarity**(): *float|null*
- Fuzzio::**getMinLevenshteinDistance**(): *int|null*
- Fuzzio::**setNormalizer**(*callable|null* $normalizer): *Fuzzio*

### FuzzioString

[](#fuzziostring)

- FuzzioString::**getString**(): *string*
- FuzzioString::**getNormalizedString**(): *string*
- FuzzioString::**getSimilarity**(): *float*
- FuzzioString::**getLevenshteinDistance**(): *int*
- FuzzioString::**\_\_toString**(): *string*

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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

Total

4

Last Release

851d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/04a9894c87cf7ea2b58fc41be2ebbb1a999e1906d209e146b0fc2fd9dd9b7b2e?d=identicon)[nullform](/maintainers/nullform)

---

Top Contributors

[![nullform](https://avatars.githubusercontent.com/u/4964609?v=4)](https://github.com/nullform "nullform (8 commits)")

---

Tags

fuzzy-searchlevenshteinlevenshtein-distancephpsimilar-textsimilaritysearchsimilar textsimilaritylevenshteinfuzzylevenshtein-distance

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nullform-fuzzio/health.svg)

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

###  Alternatives

[rap2hpoutre/similar-text-finder

Fuzzy Search, similar text finder: "Did you mean `foo` ?"

14477.9k3](/packages/rap2hpoutre-similar-text-finder)[ilya/fuzzy

Nice PHP library for fuzzy string searching

44107.9k](/packages/ilya-fuzzy)[mihanentalpo/fast-fuzzy-search

Fast fuzzy search in an array of strings for the most similiar ones

2234.0k3](/packages/mihanentalpo-fast-fuzzy-search)

PHPackages © 2026

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