meilisearch/meilisearch-laravel-scout
最新稳定版本:v0.12.5
Composer 安装命令:
composer require meilisearch/meilisearch-laravel-scout
包简介
Laravel Scout custom engine for MeiliSearch
README 文档
README
[DEPRECATED] MeiliSearch Laravel Scout
MeiliSearch | Documentation | Slack | Roadmap | Website | FAQ
⚡ The MeiliSearch driver for Laravel Scout
⚠️ This package is deprecated. We recommend you to use Laravel Scout that now supports MeiliSearch.
MeiliSearch Laravel Scout is a MeiliSearch driver for Laravel.
MeiliSearch is an open-source search engine. Discover what MeiliSearch is!
Table of Contents
- ???? Documentation
- ???? Installation
- ???? Getting Started
- ???? Compatibility with MeiliSearch
- ???? Learn More
- Development Workflow and Contributing
???? Documentation
See our Documentation or our API References.
Also, take a look at the Wiki of this repository!
???? Installation
Install the Plugin
composer require meilisearch/meilisearch-laravel-scout
Install the HTTP Client
You could use any PSR-18 compatible client to use with this SDK. No additional configurations are required.
A list of compatible HTTP clients and client adapters can be found at php-http.org.
If you use Laravel 8 you can skip this section as laravel pre-install Guzzle 7 by default.
Guzzle 7:
composer require guzzlehttp/guzzle
If you already have guzzle installed with a version < 7, don't forget to update the version inside your composer.json
"require": { "guzzlehttp/guzzle": "^7.0" }
Guzzle 6:
composer require php-http/guzzle6-adapter
Symfony Http Client:
composer require symfony/http-client nyholm/psr7
Curl:
composer require php-http/curl-client nyholm/psr7
Export Configuration
php artisan vendor:publish --provider="Laravel\Scout\ScoutServiceProvider" php artisan vendor:publish --provider="Meilisearch\Scout\MeilisearchServiceProvider" --tag="config"
Update the .env file
SCOUT_DRIVER=meilisearch MEILISEARCH_HOST=http://127.0.0.1:7700 MEILISEARCH_KEY=masterKey Run MeiliSearch
There are many easy ways to download and run a MeiliSearch instance.
For example, if you use Docker:
docker run -it --rm -p 7700:7700 getmeili/meilisearch:latest ./meilisearch --master-key=masterKey
NB: you can also download MeiliSearch from Homebrew or APT.
???? Getting Started
Indexes
Create an Index
// Create an index php artisan scout:index books // Create an index and give the primary-key php artisan scout:index books --key book_id
Add Documents
<?php use Laravel\Scout\Searchable; class Book extends Model { use Searchable; }
<?php class BookController extends Controller { public function store() { $book = new Book(); $book->title = 'Pride and Prejudice'; ... $book->save(); } }
You can also import all your table to meilisearch by using the artisan command:
php artisan scout:import "App\Book" Search in an Index
class BookController extends Controller { public function search() { // MeiliSearch is typo-tolerant: Book::search('harry pottre')->get(); // Or if you want to get the result from meilisearch: Book::search('harry pottre')->raw(); } }
Delete Documents
class BookController extends Controller { public function destroy($id) { // Delete one document Book::find($id)->delete(); // Delete several documents Book::destroy([1, 42]); // Delete all documents /!\ Book::query()->delete(); } }
or you can use the artisan command to delete all documents from an index:
php artisan scout:flush "App\Book" Delete an Index
php artisan scout:index -d books
Search
Custom Search
All the supported options are described in the search parameters section of the documentation.
use MeiliSearch\Endpoints\Indexes; class BookController extends Controller { public function customSearch() { Book::search('prince', function (Indexes $meilisearch, $query, $options) { $options['filters'] = 'author="Antoine de Saint-Exupéry"'; return $meilisearch->search($query, $options); })->take(3)->get(); } }
Pagination
class BookController extends Controller { public function search() { Book::search('mustang')->paginate(); // with a limit of items per page: Book::search('mustang')->paginate(5); // using meilisearch response: Book::search('mustang')->paginateRaw(); } }
???? Compatibility with MeiliSearch
This package only guarantees the compatibility with the version v0.20.0 of MeiliSearch.
???? Learn More
If you're not familiar with MeiliSerach yet, the following sections may interest you:
- Manipulate documents: see the API references or read more about documents.
- Search: see the API references or follow our guide on search parameters.
- Manage the indexes: see the API references or read more about indexes.
- Configure the index settings: see the API references or follow our guide on settings parameters. Also, the Wiki of this repository will guide you through the configuration!
???? You can use more advance function by reading the documentation of MeiliSearch PHP Client.
???? This package is a custom engine of Laravel Scout.
Development Workflow and Contributing
Any new contribution is more than welcome in this project!
If you want to know more about the development workflow or want to contribute, please visit our contributing guidelines for detailed instructions!
MeiliSearch provides and maintains many SDKs and Integration tools like this one. We want to provide everyone with an amazing search experience for any kind of project. If you want to contribute, make suggestions, or just know what's going on right now, visit us in the integration-guides repository.
meilisearch/meilisearch-laravel-scout 适用场景与选型建议
meilisearch/meilisearch-laravel-scout 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 197.49k 次下载、GitHub Stars 达 464, 最近一次更新时间为 2026 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「search」 「laravel」 「scout」 「meilisearch」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 meilisearch/meilisearch-laravel-scout 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 meilisearch/meilisearch-laravel-scout 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 meilisearch/meilisearch-laravel-scout 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel package to retrieve data from Google Search Console
Indexed Search Autocomplete - Extends the TYPO3 Core Extension Indexed_Search searchform with an autocomplete feature.
Elastic Driver for Laravel Scout
Abstraction Layer to index and search entities
Scout support for MoonShine
Pimcore 10.x Website Indexer (powered by Zend Search Lucene)
统计信息
- 总下载量: 197.49k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 465
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-04