Download the PHP package ez-php/search without Composer
On this page you can find all versions of the php package ez-php/search. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ez-php/search
More information about ez-php/search
Files in ez-php/search
Package search
Short Description Full-text search module for ez-php — Meilisearch and Elasticsearch drivers with event-driven index synchronisation
License MIT
Homepage https://github.com/ez-php/search
Informations about the package search
ez-php/search
Full-text search module for ez-php. Provides a driver-based search abstraction with support for Meilisearch, Elasticsearch, and Typesense, event-driven index synchronisation via ez-php/events, and an in-memory NullDriver for testing.
Installation
Requirements
- PHP 8.5+
ez-php/contractsez-php/events- A running Meilisearch, Elasticsearch, or Typesense instance (or use
NullDriverfor tests)
Configuration
Add config/search.php to your application:
Register the provider in provider/modules.php:
Making Entities Searchable
Implement SearchableInterface and use the Searchable trait:
Basic Usage
Automatic Index Synchronisation via Events
Wire SyncSearchIndex to your ORM model events in a service provider's boot():
ORM events must implement HasSearchableModel:
Rebuilding an index (search:import / search:flush)
After a mapping change or on a fresh deploy, re-import documents from the console. The module does not know where your entities live, so register a source — a closure yielding SearchableInterface instances — in one of your providers:
Each document goes through SearchIndex::add(), so DocumentIndexed fires as on a normal save. Use a generator for large tables to keep memory flat.
Events
| Event | Fired when |
|---|---|
DocumentIndexed |
A document was added or replaced |
DocumentRemoved |
A document was removed |
Drivers
| Driver | Class | Notes |
|---|---|---|
null |
NullDriver |
In-memory, for tests and local development — no external service; all-terms substring match, simple field = value / != filters joined by AND, field:asc\|desc sort; not relevance-ranked |
meilisearch |
MeilisearchDriver |
Meilisearch v1.x REST API |
elasticsearch |
ElasticsearchDriver |
Elasticsearch 8.x / OpenSearch REST API |
typesense |
TypesenseDriver |
Typesense REST API; auto-creates collections with wildcard schema |
database |
DatabaseDriver |
The application database — MySQL FULLTEXT (MATCH … AGAINST, boolean mode) or SQLite FTS5; table search.database.table (default search_documents) auto-created; every term required as a prefix, relevance-ordered; filters/sort on stored attributes evaluated in PHP (NullDriver syntax) — for small indexes, no typo tolerance or facets |
Docker
All versions of search with dependencies
ext-curl Version *
ez-php/contracts Version ^2.7.0
ez-php/events Version ^2.7.0