phaniso / autocomplete
v1.0
2016-02-29 01:13 UTC
Requires
- php: >= 5.5.0
This package is not auto-updated.
Last update: 2025-01-04 20:36:34 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