Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/markomilivojevic/autocomplete
Laravel redis autocomplete
https://github.com/markomilivojevic/autocomplete
autocomplete laravel php redis search
Last synced: about 2 months ago
JSON representation
Laravel redis autocomplete
- Host: GitHub
- URL: https://github.com/markomilivojevic/autocomplete
- Owner: markomilivojevic
- Created: 2019-11-28T21:26:00.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-07-31T13:35:02.000Z (over 4 years ago)
- Last Synced: 2024-08-04T23:30:57.536Z (5 months ago)
- Topics: autocomplete, laravel, php, redis, search
- Language: PHP
- Homepage:
- Size: 6.84 KB
- Stars: 28
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
- awesome - markomilivojevic/autocomplete - Laravel redis autocomplete (PHP)
README
# Laravel redis autocomplete
## Installation
```bash
$ composer require ducha/autocomplete
```
## Usage
Import facade:
```php
//...
use Ducha\Autocomplete\Facades\Autocomplete;
//...
```
#### Main methods
Store item to bucket:
```php
Autocomplete::addTerm('cities', 'Berlin');
```
Get suggestions from bucket:
```php
Autocomplete::complete('cities', 'Ber');
```#### All methods
```php
/**
* 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)
*/
```