PHPackages                             gordonlesti/levenshtein - 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. gordonlesti/levenshtein

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

gordonlesti/levenshtein
=======================

1.1.0(3mo ago)658.5k—0%1MITPHPPHP &gt;=8.2

Since Jan 19Pushed 3mo ago1 watchersCompare

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

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

levenshtein
===========

[](#levenshtein)

[![Latest Version on Packagist](https://camo.githubusercontent.com/918bb8be840d4dbd186a784fb1e84e8f473d31357b28173f02ea9e198cd79ec3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f676f72646f6e6c657374692f6c6576656e73687465696e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gordonlesti/levenshtein)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/597d7bc083184f6a8e352f757c31a7990dbed31d3bd8a3bd7bef7d8ba8d5826c/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f476f72646f6e4c657374692f6c6576656e73687465696e2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/GordonLesti/levenshtein)[![Coverage Status](https://camo.githubusercontent.com/528ef8ae9d70166ecfc6f9e5290a262ec1567bf0baca04ba08ad65600a534e02/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f476f72646f6e4c657374692f6c6576656e73687465696e2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://coveralls.io/r/GordonLesti/levenshtein?branch=master)[![Total Downloads](https://camo.githubusercontent.com/c12f421ba9e2d7adea3611f64813652dcfb513834a8d6b6968d3efe627d868bd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f676f72646f6e6c657374692f6c6576656e73687465696e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gordonlesti/levenshtein)

Plain PHP implementation of the Levenshtein distance.

- No 255 characters limit
- Works with UTF-8
- Accepts float as custom costs

Install
-------

[](#install)

Via Composer

```
$ composer require gordonlesti/levenshtein
```

Usage
-----

[](#usage)

```
use GordonLesti\Levenshtein\Levenshtein;
```

With default default costs.

```
$levDist = Levenshtein::levenshtein("AC", "ABAA");
```

With insert cost `7.7`, replace cost `9.4` and delete cost `2.5`.

```
$levDist = Levenshtein::levenshtein("ACCB", "BC", 7.7, 9.4, 2.5);
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Gordon Lesti](https://gordonlesti.com)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

55

—

FairBetter than 98% of packages

Maintenance81

Actively maintained with recent releases

Popularity34

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity77

Established project with proven stability

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

Total

2

Last Release

102d ago

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

1.1.0PHP &gt;=8.2

### Community

Maintainers

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

---

Top Contributors

[![GordonLesti](https://avatars.githubusercontent.com/u/1677744?v=4)](https://github.com/GordonLesti "GordonLesti (17 commits)")

---

Tags

levenshtein-distancephp

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/gordonlesti-levenshtein/health.svg)

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

PHPackages © 2026

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