commerce-wa-ols / nicknames
Find nicknames for a given name or perform a reverse search on a nickname.
Requires
- php: ~5.6 || ~7.0
Requires (Dev)
- phpunit/phpunit: ~5.0
This package is not auto-updated.
Last update: 2025-05-07 01:21:39 UTC
README
Nicknames is a simple package that either returns an array of common nicknames for a provided name or returns an array of potential matches to a provided nickname. The data features common English diminutives, nicknames and shortened forms, of given names.
For example, "William" may appear in databases as "Bill" or "Willie", and "Rebecca" as "Becca" or "Becky".
The list of names is from Diminutives.db with some extra names added to the list from our sources. The idea behind the package has also taken heavy influence from the ruby gem Nickname which also has some great information about other techniques for fuzzy matching strings.
Usage
Get nicknames for a given formal name.
Nicknames::givenTo("William");use CommerceWA\Utilities\Nicknames;
The above example will return:
Array ( [0] => bill [1] => billy [2] => will [3] => willie [4] => willy )
Get the formal name for a given nickname.
use CommerceWA\Utilities\Nicknames; Nicknames::givenTo("Becky");
The above example will return:
Array ( [0] => rebecca )
Why?
The library was created to solve issues when trying match names from multiple databases where full names and preferred names (nicknames) were used to identify a person.
Example of different names for the same person
first_name | surname | |
---|---|---|
Database 1 | Bill | Doe |
Database 2 | William | Doe |
Installation
This package uses composer so you can just add
commerce-wa-ols/nicknames
as a dependency to your composer.json
file or
execute the following command:
composer require commerce-wa-ols/nicknames
Contributors
Developed by Cyrus Eftos at the Department of Commerce.