PHPackages                             glueful/meilisearch - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Search &amp; Filtering](/categories/search)
4. /
5. glueful/meilisearch

ActiveGlueful-extension[Search &amp; Filtering](/categories/search)

glueful/meilisearch
===================

Meilisearch full-text search integration for Glueful Framework

v1.6.0(2mo ago)1439MITPHPPHP ^8.3

Since Feb 4Pushed 2mo agoCompare

[ Source](https://github.com/glueful/meilisearch)[ Packagist](https://packagist.org/packages/glueful/meilisearch)[ Docs](https://github.com/glueful/meilisearch)[ RSS](/packages/glueful-meilisearch/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (10)Versions (15)Used By (0)

Glueful Meilisearch Extension
=============================

[](#glueful-meilisearch-extension)

Full-text search integration for the Glueful Framework using [Meilisearch](https://www.meilisearch.com/).

Overview
--------

[](#overview)

The Meilisearch extension provides seamless integration between Glueful Framework and Meilisearch, an open-source, lightning-fast search engine. This extension enables models to be searchable with minimal configuration while providing advanced search features like typo tolerance, filtering, faceting, and geo-search.

Features
--------

[](#features)

- **Searchable trait**: Make any model searchable with a simple trait
- **Automatic syncing**: Keep search index in sync with database changes via model events
- **Transaction-safe indexing**: Indexing deferred until after database transactions commit
- **Fluent query builder**: Intuitive API for building complex search queries
- **Filters and facets**: Full support for Meilisearch filtering and faceted search
- **Geo-search**: Location-based search with radius and bounding box filters
- **Pagination**: Built-in pagination with metadata
- **Queue support**: Optional async indexing via queue workers
- **Batch operations**: Efficient bulk indexing with configurable batch sizes
- **Index prefixing**: Multi-tenant friendly with configurable index prefixes
- **CLI commands**: Index management and debugging tools

Installation
------------

[](#installation)

### Installation (Recommended)

[](#installation-recommended)

**Install via Composer**

```
composer require glueful/meilisearch
```

Composer discovers packages of type `glueful-extension`, but **installing does not auto-enable** them — the provider must be in `config/extensions.php`'s `enabled` allow-list. Enable/disable in development (these commands edit `config/extensions.php` and recompile the cache):

```
# Enable the extension (adds the provider FQCN to `enabled`)
php glueful extensions:enable meilisearch

# Disable the extension (removes it from `enabled`)
php glueful extensions:disable meilisearch

# Preview changes without writing
php glueful extensions:enable meilisearch --dry-run

# Create a .bak backup before editing
php glueful extensions:enable meilisearch --backup
```

In production, manage the `enabled` list in config and run `php glueful extensions:cache` in your deploy step.

### Local Development Installation

[](#local-development-installation)

To develop the extension locally, register it as a Composer **path repository** in your app's `composer.json`, then require and enable it:

```
// composer.json
"repositories": [
    { "type": "path", "url": "extensions/meilisearch", "options": { "symlink": true } }
]
```

```
composer require glueful/meilisearch:@dev
php glueful extensions:enable meilisearch
```

### Verify Installation

[](#verify-installation)

Check status and details:

```
php glueful extensions:list
php glueful extensions:info meilisearch
```

Requirements
------------

[](#requirements)

- PHP 8.3 or higher
- Glueful Framework 1.27.0 or higher
- Meilisearch server (v1.6+ recommended)
- meilisearch/meilisearch-php ^1.6 (installed automatically)

### Installing Meilisearch Server

[](#installing-meilisearch-server)

The extension requires a running Meilisearch server. Choose one of the following installation methods:

**Docker (Recommended)**

```
docker run -d -p 7700:7700 \
  -v $(pwd)/meili_data:/meili_data \
  -e MEILI_MASTER_KEY='your-master-key' \
  getmeili/meilisearch:v1.6
```

**Homebrew (macOS)**

```
brew install meilisearch
meilisearch --master-key="your-master-key"
```

**Binary Download**

Download the latest binary for your platform from the [Meilisearch releases page](https://github.com/meilisearch/meilisearch/releases) or follow the [official installation guide](https://www.meilisearch.com/docs/learn/getting_started/installation).

```
# Example for Linux
curl -L https://install.meilisearch.com | sh
./meilisearch --master-key="your-master-key"
```

**Meilisearch Cloud**

For production, consider [Meilisearch Cloud](https://www.meilisearch.com/cloud) for a fully managed solution.

Configuration
-------------

[](#configuration)

Set the following environment variables in your `.env` file:

```
# Meilisearch connection
MEILISEARCH_HOST=http://127.0.0.1:7700
MEILISEARCH_KEY=your-master-key

# Index prefix (optional, useful for multi-tenant or staging/production separation)
MEILISEARCH_PREFIX=myapp_

# HTTP search routes are deny-by-default. Add index names without prefix.
MEILISEARCH_ALLOWED_INDEXES=posts,parps,entities

# Indexes that do not need a server-side scope filter, such as public documents
MEILISEARCH_PUBLIC_INDEXES=posts

# Queue configuration (optional, for async indexing)
MEILISEARCH_QUEUE=false
MEILISEARCH_QUEUE_CONNECTION=redis
MEILISEARCH_QUEUE_NAME=search

# Batch configuration
MEILISEARCH_BATCH_SIZE=500
MEILISEARCH_BATCH_TIMEOUT=30

# Search defaults
MEILISEARCH_DEFAULT_LIMIT=20
MEILISEARCH_SOFT_DELETE=true
```

### Configuration File

[](#configuration-file)

The extension configuration is located at `config/meilisearch.php`:

```
