phaniso / autocomplete
Installs: 125
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
pkg:composer/phaniso/autocomplete
Requires
- php: >= 5.5.0
This package is not auto-updated.
Last update: 2025-10-12 00:58:17 UTC
README
Autocomplete PHP library that utilize trie data structure.
###Installation
composer require phaniso/autocomplete
###How to use
- Build container
use Autocomplete\Factory\ContainerFactory;
$containerFactory = new ContainerFactory;
$trie = $containerFactory->build('Trie');
By default trie is case sensitive if you want to change it pass false as an argument
$trie = $containerFactory->build('Trie', [false]);
2.Add word
$trie->addWord('randomWord');
3.Get word(s) using prefix
$words = $trie->getByPrefix('random');
$words variable will now contain one element with 'randomWord' value