dwarfdk/laravel-meilitools
Composer 安装命令:
composer require dwarfdk/laravel-meilitools
包简介
Additional tools for Laravel Scout integration with MeiliSearch
README 文档
README
The purpose of this package is to ease the configuration of indexes for MeiliSearch, so it's possible to use advanced filtering and sorting through Laravel Scout, without having to meddle with their API manually.
Table of Contents
Compatibility
| Engine | 0.1.x | 0.2.x | 0.3.x | 0.4.x |
|---|---|---|---|---|
| v0.26.x | X | X | ||
| v0.27.x | X | X | ||
| v0.28.x | X | |||
| v0.29.x | X | |||
| v0.30.x | X | |||
| v1.x.x | X |
Installation
Install this package via Composer:
$ composer require dwarfdk/laravel-meilitools
Configuration
Publish config using Artisan command:
$ php artisan vendor:publish --provider="Dwarf\MeiliTools\MeiliToolsServiceProvider"
Change configuration through config/meilitools.php.
Usage
This package provides commands and helpers to ease the use of configuring MeiliSearch indexes.
Model Settings
Setup index settings for a model by implementing the method provided by the contract.
use Dwarf\MeiliTools\Contracts\Indexes\MeiliSettings; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; use Laravel\Scout\Searchable; class Article extends Model implements MeiliSettings { use Searchable; use SoftDeletes; /** * {@inheritdoc} */ public function meiliSettings(): array { // When using soft deletes '__soft_deleted' will automatically be added to filterable attributes. return ['filterableAttributes' => ['status']]; } }
A full list of available index settings can be found here.
Commands
The following commands are available:
meili:index:create - Create a new MeiliSearch index
Arguments:
index: Index name
Options:
--force: Force the operation to run
meili:index:delete - Delete a MeiliSearch index
Arguments:
index: Index name
meili:index:details - Get details for a MeiliSearch index
Arguments:
index: Index name
meili:index:reset - Reset settings for a MeiliSearch index
Arguments:
index: Index name
Options:
--pretend: Only shows what changes would have been done to the index
meili:index:view - Get base information about a MeiliSearch index
Arguments:
index: Index name
Options:
--stats: Whether to include index stats
meili:indexes:list - List all MeiliSearch indexes
Options:
--stats: Whether to include index stats
meili:model:details - Get details for a MeiliSearch model index
Arguments:
model: Model class
meili:model:reset - Reset settings for a MeiliSearch model index
Arguments:
model: Model class
Options:
--pretend: Only shows what changes would have been done to the index
meili:model:synchronize - Synchronize settings for a MeiliSearch model index
Arguments:
model: Model class
meili:model:view - Get base information about a MeiliSearch model index
Arguments:
model: Model class
Options:
--stats: Whether to include index stats
Options:
--pretend: Only shows what changes would have been done to the index
meili:models:synchronize - Synchronize all models implementing MeiliSearch index settings
Options:
--pretend: Only shows what changes would have been done to the indexes--force: Force the operation to run when in production
Examples
Model commands can take both full class name and base name, with the latter being completed using the configured paths.
$ php artisan meili:model:details App\\Models\\Article
$ php artisan meili:model:details Article
$ php artisan meili:model:reset App\\Models\\Article
$ php artisan meili:model:reset Article
$ php artisan meili:model:synchronize App\\Models\\Article
$ php artisan meili:model:synchronize Article
$ php artisan meili:model:view App\\Models\\Article
$ php artisan meili:model:view Article
Testing
Running tests can be done either through composer, or directly calling the PHPUnit binary.
$ composer test
To run tests with code coverage, please make sure that phpdbg exists and is executable.
$ composer test:coverage
Career
Dwarf A/S is a digital agency based in Copenhagen (Denmark) and established January 1st 2000.
We're always looking for new talent, so have a look at our website for job openings.
License
The MIT License (MIT). Please see License File for more information.
dwarfdk/laravel-meilitools 适用场景与选型建议
dwarfdk/laravel-meilitools 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 23.3k 次下载、GitHub Stars 达 100, 最近一次更新时间为 2022 年 06 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「scout」 「meilisearch」 「meili」 「meilitools」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 dwarfdk/laravel-meilitools 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 dwarfdk/laravel-meilitools 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 dwarfdk/laravel-meilitools 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Elastic Driver for Laravel Scout
Scout support for MoonShine
Laravel Scout extension that allows to use meilisearch advanced features as well as has an extended collection driver for testing purposes.
Extendable Statamic Meilisearch search driver
Elastic Driver for Laravel Scout
search for the webman
统计信息
- 总下载量: 23.3k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 100
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-06-20