ducha /
使用Redis的Laravel自动完成建议
v1.0.1
2020-07-31 13:26 UTC
Requires
- php: >=7.2.0
Requires (Dev)
- orchestra/testbench: ^4.0
This package is auto-updated.
Last update: 2024-09-29 05:35:48 UTC
README
安装
$ composer require ducha/autocomplete
使用
导入外观
//... 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) */