PHPackages                             toanld/similar-text-finder - 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. toanld/similar-text-finder

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

toanld/similar-text-finder
==========================

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

1.1.0(7y ago)022MITPHPPHP ^7.0

Since Apr 21Pushed 4y agoCompare

[ Source](https://github.com/toanld/similar-text-finder)[ Packagist](https://packagist.org/packages/toanld/similar-text-finder)[ RSS](/packages/toanld-similar-text-finder/feed)WikiDiscussions master Synced 1mo ago

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

Similar Text Finder
===================

[](#similar-text-finder)

[![Packagist](https://camo.githubusercontent.com/48f48a534019e331a8a57e2c957ba6e351f1f1a8d2b5eab3e80144c13f992e36/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7261703268706f757472652f73696d696c61722d746578742d66696e6465722e737667)](https://packagist.org/packages/rap2hpoutre/similar-text-finder) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/fb1c9d45aa61679b91abb26db4f0d26e4c568713ed9cb2ae96834ba21bf49714/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7261703268706f757472652f73696d696c61722d746578742d66696e6465722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/rap2hpoutre/similar-text-finder/?branch=master)[![Build Status](https://camo.githubusercontent.com/9fe68eb5c91c11b1e30bca33bc58d979dc45a0ffcefdea2b60577d3149734f6c/68747470733a2f2f7472617669732d63692e6f72672f7261703268706f757472652f73696d696c61722d746578742d66696e6465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/rap2hpoutre/similar-text-finder)[![Code Coverage](https://camo.githubusercontent.com/0fbcd3a6fea8fcd9fd25cb4af0e4957646dcbfdf921828d2d1bd5a24ce787b64/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7261703268706f757472652f73696d696c61722d746578742d66696e6465722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/rap2hpoutre/similar-text-finder/?branch=master)[![SensioLabsInsight](https://camo.githubusercontent.com/9390b59de4f9c4ae00e63e884e42adf8d2603a1dfeccfab34f99a11363ea1b96/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f64303233343764322d623330372d343731652d616562352d3261333131383366356431392f6d696e692e706e67)](https://insight.sensiolabs.com/projects/d02347d2-b307-471e-aeb5-2a31183f5d19)[![Packagist](https://camo.githubusercontent.com/0c83c80ac26458bb59ff62bca4b7b6ba9dbe0e10b8f6e8b748de7c9cb9fadd43/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7261703268706f757472652f73696d696c61722d746578742d66696e6465722e737667)](https://packagist.org/packages/rap2hpoutre/similar-text-finder)

TL;DR
-----

[](#tldr)

Similar text finder. Install via composer, works with any framework: Laravel, Slim, Symfony, etc.

[![screenshot](https://cloud.githubusercontent.com/assets/1575946/7246876/1b15c4c0-e803-11e4-91d8-a2e7cd5a0f0c.png)](https://cloud.githubusercontent.com/assets/1575946/7246876/1b15c4c0-e803-11e4-91d8-a2e7cd5a0f0c.png)

```
// Init Similar Text Finder with a needle and a haystack
$text_finder = new \SimilarText\Finder('bananna', ['apple', 'banana', 'kiwi']);

// Get first similar word (it's banana)
echo $text_finder->first();
```

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

[](#installation)

Install with composer `composer require rap2hpoutre/similar-text-finder`. That's all.

You can now use it in your framework's controller, or wherever you want (you don't need a framework anyway).

Usage
-----

[](#usage)

### Quick start

[](#quick-start)

Just build a new Similar Text Finder like this:

```
$tf = new \SimilarText\Finder($needle, $haystack);
```

`$needle` may be the user input and `$haystack` should be an array with all your suggestion. You can display the closest response like this:

```
echo 'Did you mean ' $tf->first() . ' ?';
```

Or use it in your favorite template engine (Twig, Blade, etc.)

You can get all your suggestion ordered by most approching words like this:

```
$all = $tf->all();
```

### Example in raw PHP

[](#example-in-raw-php)

```
use SimilarText\Finder;

// User input with a typo (you could get it from $_GET)
$needle = 'tmatoes';

// Your list (from your database or an API)
$haystack = ['salad', 'tomatoes', 'onions', 'mates'];

// Init Text Finder
$finder = new Finder($needle, $haystack);

// Display all results ordered by the most approching
$results = $finder->all();
echo implode(', ', $results);

// You should see something like "tomatoes, mates, onions, salad", yohoo.
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 88% 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 ~200 days

Recently: every ~345 days

Total

8

Last Release

2640d ago

Major Versions

v0.3.0 → v1.0.02019-01-02

### Community

Maintainers

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

---

Top Contributors

[![rap2hpoutre](https://avatars.githubusercontent.com/u/1575946?v=4)](https://github.com/rap2hpoutre "rap2hpoutre (44 commits)")[![josegonzalez](https://avatars.githubusercontent.com/u/65675?v=4)](https://github.com/josegonzalez "josegonzalez (2 commits)")[![toanld](https://avatars.githubusercontent.com/u/33773069?v=4)](https://github.com/toanld "toanld (2 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

---

Tags

searchlaraveltextsimilar textfindlevenshteinfuzzy

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/toanld-similar-text-finder/health.svg)

```
[![Health](https://phpackages.com/badges/toanld-similar-text-finder/health.svg)](https://phpackages.com/packages/toanld-similar-text-finder)
```

###  Alternatives

[rap2hpoutre/similar-text-finder

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

13877.7k3](/packages/rap2hpoutre-similar-text-finder)[mmanos/laravel-search

A search package for Laravel 5.

36475.7k1](/packages/mmanos-laravel-search)

PHPackages © 2026

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