Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Meilisearch Php

Meilisearch Php Laravel Package

meilisearch/meilisearch-php

The official Meilisearch API client for PHP. Integrate fast, open-source search into your PHP applications with a simple SDK, customizable HTTP clients, and compatibility with Meilisearch servers.

View on GitHub
Deep Wiki
Context7

PHP wrapper for the Meilisearch API

Frequently asked questions about Meilisearch Php
Is meilisearch/meilisearch-php a Laravel package or just an API client?
It is a thin, stateless HTTP SDK for the Meilisearch REST API, not a Laravel package. It has no service provider, facade, config file, or migrations, so Composer install alone does not give you a fully integrated Laravel search layer. Most teams add a small adapter with a singleton binding, environment-driven config, and a search service interface.
How do I install and configure Meilisearch in a Laravel application?
Install the SDK with Composer alongside a PSR-18 HTTP client and PSR-17 factory, such as Guzzle 7. Then set your Meilisearch host and API key as environment variables and construct the client in a service provider or singleton binding. Because the package publishes no Laravel config, keep those settings in config/services.php or a dedicated config file you own.
Should I use Laravel Scout or the Meilisearch PHP SDK directly?
Laravel Scout owns model-to-index syncing, observers, and queueing, with the Meilisearch SDK as an implementation detail; it is less code but gives you less control. Using the SDK directly gives full control over document shape, index settings, task handling, and multi-search, but you own all synchronization logic. Decide this before estimating work because the effort differs materially and affects how easily you could swap search engines later.
Should I use the stable 1.x line or the 2.0 beta of meilisearch-php?
For production Laravel apps, default to the stable ^1.x line and pin your Meilisearch server version alongside it. The 2.0 beta includes breaking changes such as Indexes becoming Index, removed lazy metadata helpers like fetchInfo(), non-nullable getters, and MultiSearchQuery split out of SearchQuery. Adopting the beta requires an explicit feature justification and a plan to absorb those changes.
Can I replace Guzzle with Symfony HttpClient or another HTTP client?
Yes. The SDK is built around PSR-18 and PSR-17, so Guzzle 7, Symfony HttpClient, cURL, and Buzz are all viable transports. This lets you inject a preconfigured client with your own connection and read timeouts, retry policy, and middleware. That control matters when search sits on a page render path and must not become a latency amplifier.
Why is a document not searchable immediately after addDocuments()?
Meilisearch writes are asynchronous: addDocuments() returns a task UID rather than a completed result, and documents become searchable only after that task succeeds. Any requirement like save a record and immediately find it in search is a design problem, not a missing SDK call. Poll or wait on the task where needed, queue the sync work, and set realistic freshness expectations in your UX.
How do I make filtering and sorting work with the Meilisearch PHP SDK?
You must declare filterableAttributes and sortableAttributes on the index before filtering or sorting will work. Changing those settings can trigger an index rebuild, so treat them as deploy events rather than runtime configuration. On large datasets, an unplanned settings change can cause visible search outages.
How should I handle API keys and multi-tenant search in Laravel?
Never expose the Meilisearch master key to the client or frontend. For multi-tenant or per-user filtered search, use scoped API keys or signed tenant tokens that restrict which documents a user can see. Keep key provisioning server-side and rotate keys as part of your deployment and security process.
How do I test Laravel code that uses the Meilisearch PHP SDK?
The SDK ships no Laravel testing helpers, so wrap it behind your own interface and fake that interface in unit tests. For HTTP-level tests, inject a fake PSR-18 client to assert request shape and error handling. Keep a smaller set of integration tests against a disposable Meilisearch instance to verify task handling, index settings, and filtering behavior.
What happens to my Laravel app if the Meilisearch server goes down?
Once search backs primary navigation or listing pages, Meilisearch availability becomes a product availability question. The SDK provides no circuit breaker or automatic fallback, so you must build degradation behavior yourself. Consider cached results, a database fallback path, and monitoring around search latency and error rates before launch.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
vento/laravel-airbrake
wfeller/laravel-batch
maco-studios/mage-os-installer
busarm/armie
siberfx/laravel-logger
kfteam1991/dcat-admin
dashed/dashed-laposta
dashed/dashed-ecommerce-montaportal
dashed/dashed-ecommerce-etsy
neohq/string-blade-compiler
log1x/acf-composer
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core
nodisrupt/laravel-agent
sierratecnologia/media-manager