PHP code example of ducha / autocomplete

1. Go to this page and download the library: Download ducha/autocomplete library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ducha / autocomplete example snippets


//...
use Ducha\Autocomplete\Facades\Autocomplete;
//...

Autocomplete::addTerm('cities', 'Berlin');

Autocomplete::complete('cities', 'Ber');

/** 
 * Add an item to bucket
 * @method static bool addTerm(string $bucket, string $term)
 *
 * Add more items to bucket
 * @method static int addTerms(string $bucket, array $terms)
 * 
 * Remove item from bucket
 * @method static bool removeTerm(string $bucket, string $term)
 *
 * Autocomplete term
 * @method static array complete(string $bucket, string $prefix)
 *
 * Get all items from bucket
 * @method static array all(string $bucket)
 */