PHPackages                             ifcanduela/abbrev - 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. ifcanduela/abbrev

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

ifcanduela/abbrev
=================

Create unambiguous abbreviations for words in a list

1.0.0(9y ago)0330↓90%1MITPHP

Since Jun 22Pushed 9y ago1 watchersCompare

[ Source](https://github.com/ifcanduela/abbrev)[ Packagist](https://packagist.org/packages/ifcanduela/abbrev)[ RSS](/packages/ifcanduela-abbrev/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (1)Versions (2)Used By (1)

Abbrev
======

[](#abbrev)

Find unambiguous abbreviations for all words in a list.

Just like [npm's abbrev](https://www.npmjs.com/package/abbrev), which is just like [ruby's Abbrev](http://apidock.com/ruby/Abbrev).

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

[](#installation)

Use composer:

```
composer install ifcanduela/abbrev

```

Usage
-----

[](#usage)

Feed a word list to the `Abbrev` constructor and then call one of the three public methods.

Suggestions and matches are case-insensitive. The constructor accepts any number of strings or arrays of strings, arbitrarily nested. Once you have an instance it's ready to go.

```
use ifcanduela\abbrev\Abbrev;

$abbrev = new Abbrev(
        'foo',
        'bar',
        ['baz', 'foobar', ['barbaz']],
    );
```

### Abbrev::match($word)

[](#abbrevmatchword)

Get a matching word from the list, or `false` if the input is ambiguous.

```
$abbrev = new Abbrev(['ape', 'aperture', 'apprentice'], 'albino', 'append');

$match = $abbrev->match('ap'); // there is not unambiguous match
// => false

$match = $abbrev->match('al'); // there is only one possible match
// => "albino"
```

### Abbrev::suggest($word)

[](#abbrevsuggestword)

Get a list of matching words from the list for an ambiguous or unambiguous input.

```
$abbrev = new Abbrev(['ape', 'aperture', 'apprentice'], 'albino', 'append');

$suggestions = $abbrev->suggest('app');
// append
// apprentice
```

### Abbrev::abbreviate()

[](#abbrevabbreviate)

Retrieve a list of all possible abbreviations.

```
$abbrev = new Abbrev(['ape', 'aperture', 'apprentice'], 'albino', 'append');

$suggestions = $abbrev->abbreviate();
// [
//   'alb'        => 'albino',
//   'albi'       => 'albino',
//   'albin'      => 'albino',
//   'albino'     => 'albino',
//   'ape'        => 'ape',
//   'aper'       => 'aperture',
//   'apert'      => 'aperture',
//   'apertu'     => 'aperture',
//   'apertur'    => 'aperture',
//   'aperture'   => 'aperture',
//   'appe'       => 'append',
//   'appen'      => 'append',
//   'append'     => 'append',
//   'appr'       => 'apprentice',
//   'appre'      => 'apprentice',
//   'appren'     => 'apprentice',
//   'apprent'    => 'apprentice',
//   'apprenti'   => 'apprentice',
//   'apprentic'  => 'apprentice',
//   'apprentice' => 'apprentice',
// ]
```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity63

Established project with proven stability

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

Unknown

Total

1

Last Release

3288d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1359230?v=4)[Igor Fernández Canduela](/maintainers/ifcanduela)[@ifcanduela](https://github.com/ifcanduela)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ifcanduela-abbrev/health.svg)

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

PHPackages © 2026

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