ilya / fuzzy
Nice PHP library for fuzzy string searching
Installs: 67 438
Dependents: 0
Suggesters: 0
Security: 0
Stars: 42
Watchers: 5
Forks: 8
Open Issues: 0
Requires (Dev)
- phpspec/phpspec: ~2
This package is not auto-updated.
Last update: 2024-11-08 22:01:48 UTC
README
Fuzzy searching in PHP made easy!
Installation
composer require ilya/fuzzy:~1
Use
array search(array $rows, string $query, integer $threshold = 3)
$rows = ['f', 'fo', 'foo', 'foob', 'fooba', 'foobar']; $fuzzy = new \Fuzzy\Fuzzy; $query = 'foobar'; $fuzzy->search($rows, $query, 0); // ['foobar'] $fuzzy->search($rows, $query, 1); // ['foobar', 'fooba'] $fuzzy->search($rows, $query, 2); // ['foobar', 'fooba', 'foob'] $fuzzy->search($rows, $query, 3); // ['foobar', 'fooba', 'foob', 'foo']
License
This project is licensed under the MIT license.