PHPackages                             esplora/similar - 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. esplora/similar

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

esplora/similar
===============

Unlock the power of effortless grouping by identifying similar strings based on shared topics within a set of sentences.

2.2.0(4y ago)6137.3kMITPHPPHP ^7.3|^8.0CI passing

Since Nov 14Pushed 2y ago1 watchersCompare

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

READMEChangelog (7)Dependencies (2)Versions (8)Used By (0)

[![Similar PHP](.github/logo.svg?sanitize=true)](.github/logo.svg?sanitize=true) Similar
========================================================================================

[](#-similar)

[![Unit tests](https://github.com/esplora/similar/workflows/Unit%20tests/badge.svg)](https://github.com/esplora/similar/workflows/Unit%20tests/badge.svg)

This is an elementary library for working on identifying similar strings in PHP without using machine learning. It allows you to get groups of one topic from the transferred set of sentences. For example, combine news headlines from different publications, as Google News does.

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

[](#installation)

Run this at the command line:

```
$ composer require esplora/similar
```

Usage
-----

[](#usage)

We need to create an object by passing a closure function as an argument, which checks if two strings are similar:

```
use Esplora\Similar\Similar;

$similar = new Similar(function (string $a, string $b) {
    similar_text($a, $b, $copy);

    return 51 < $copy;
});
```

> Note that you don't need to use `similar_text`. You can use other implementations like `soundex` or something else.

Then we have to call the `findOut` method passing it a one-dimensional array with strings:

```
$similar->findOut([
    'Elon Musk gets mixed COVID-19 test results as SpaceX launches astronauts to the ISS',
    'Elon Musk may have Covid-19, should quarantine during SpaceX astronaut launch Sunday',

    // Superfluous word
    'Can Trump win with ‘fantasy’ electors bid? State GOP says no',
]);
```

As a result, there will be only one group containing headers:

```
'Elon Musk gets mixed COVID-19 test results as SpaceX launches astronauts to the ISS',
'Elon Musk may have Covid-19, should quarantine during SpaceX astronaut launch Sunday',
```

Keys
----

[](#keys)

The input array stores its keys so that you can do additional processing:

```
$similar->findOut([
  'kos' => "Trump acknowledges Biden's win in latest tweet",
  'foo' => 'Elon Musk gets mixed COVID-19 test results as SpaceX launches astronauts to the ISS',
  'baz' => 'Trump says Biden won but again refuses to concede',
  'bar' => 'Elon Musk may have Covid-19, should quarantine during SpaceX astronaut launch Sunday',
]);
```

The result will be two groups:

```
[
  'foo' => 'Elon Musk gets mixed COVID-19 test results as SpaceX launches astronauts to the ISS',
  'bar' => 'Elon Musk may have Covid-19, should quarantine during SpaceX astronaut launch Sunday',
],
[
  'baz' => 'Trump says Biden won but again refuses to concede',
  'kos' => "Trump acknowledges Biden's win in latest tweet",
],
```

Objects
-------

[](#objects)

It is also possible to pass objects to evaluate more complex conditions. Each passed object must be able to cast to a string via the `__toString()` method.

```
$similar->findOut([
    new FixtureStingObject('Lorem ipsum dolor sit amet, consectetur adipiscing elit.'),
]);
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 93.6% 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 ~77 days

Recently: every ~99 days

Total

7

Last Release

1544d ago

Major Versions

1.1.0 → 2.0.02021-01-22

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

2.2.0PHP ^7.3|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/3c47797b11041f37c2eec74b09bc6619c8997467d690797ebad0e6ab7cb232b7?d=identicon)[tabuna](/maintainers/tabuna)

---

Top Contributors

[![tabuna](https://avatars.githubusercontent.com/u/5102591?v=4)](https://github.com/tabuna "tabuna (44 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![SadElephant](https://avatars.githubusercontent.com/u/7434276?v=4)](https://github.com/SadElephant "SadElephant (1 commits)")

---

Tags

similar

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/esplora-similar/health.svg)

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

###  Alternatives

[illuminate/support

The Illuminate Support package.

583107.1M34.5k](/packages/illuminate-support)[illuminate/events

The Illuminate Events package.

13454.3M1.8k](/packages/illuminate-events)[illuminate/config

The Illuminate Config package.

10842.7M2.2k](/packages/illuminate-config)[illuminate/session

The Illuminate Session package.

9937.4M753](/packages/illuminate-session)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[illuminate/broadcasting

The Illuminate Broadcasting package.

7126.5M178](/packages/illuminate-broadcasting)

PHPackages © 2026

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