2017 © Pedro Peláez
 

package autocomplete

Simple autocomplete functionality

image

phparmory/autocomplete

Simple autocomplete functionality

  • Wednesday, June 1, 2016
  • by rphcrosby
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Autocomplete

A useful package for efficient autocomplete functionality., (*1)

Installation

Using composer:, (*2)

composer require phparmory/autocomplete, (*3)

Example usage

<?php
use Armory\Autocomplete\Autocomplete;
use Armory\Autocomplete\Repositories\ArrayRepository;

$autocomplete = new Autocomplete(new ArrayRepository);

$autocomplete->index(1, "King Kong", 'movies'); // Indexes 'King Kong' against ID 1 in the 'movies' namespace
$autocomplete->index(2, "King's Speech", 'movies'); // Indexes "King's speech" against ID 2 in the 'movies' namespace

$autocomplete->find('King', 'movies'); // Returns [1, 2];
$autocomplete->find("King's", 'movies'); // Returns [2];

Repositories

Autocomplete comes with an array and a Redis repository. An example using Redis:, (*4)

<?php
use Armory\Autocomplete\Autocomplete;
use Armory\Autocomplete\Repositories\RedisRepository;
use Predis\Client;

$autocomplete = new Autocomplete(new RedisRepository(new Client));

$autocomplete->index(1, 'Spiderman', 'movies');

$autocomplete->find('spider', 'movies'); // Returns [1]

The Versions

01/06 2016

dev-master

9999999-dev

Simple autocomplete functionality

  Sources   Download

MIT

The Development Requires

by Richard Crosby