PHPackages                             zhuzixian520/yii2-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. zhuzixian520/yii2-meilisearch

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

zhuzixian520/yii2-meilisearch
=============================

This extension provides the MeiliSearch integration for the Yii framework 2.0.

1.0.0(4y ago)1163662MITPHPPHP &gt;=5.6.0

Since Feb 11Pushed 4y ago1 watchersCompare

[ Source](https://github.com/zhuzixian520/yii2-meilisearch)[ Packagist](https://packagist.org/packages/zhuzixian520/yii2-meilisearch)[ RSS](/packages/zhuzixian520-yii2-meilisearch/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

 [ ![yii2 logo](https://avatars0.githubusercontent.com/u/993323) ](https://github.com/yiisoft) [ ![meilisearch logo](https://raw.githubusercontent.com/meilisearch/integration-guides/main/assets/logos/logo.svg) ](https://github.com/meilisearch)MeiliSearch Extension For Yii2 Framework
========================================

[](#meilisearch-extension-for-yii2-framework)

[![Latest Stable Version](https://camo.githubusercontent.com/870985bedb11217716c3b4aa0e04f9d0a9376c7e5323a40d6528ad4db2cea0bc/687474703a2f2f706f7365722e707567782e6f72672f7a68757a697869616e3532302f796969322d6d65696c697365617263682f76)](https://packagist.org/packages/zhuzixian520/yii2-meilisearch) [![Total Downloads](https://camo.githubusercontent.com/7bb824a2ad1917dff53433db5d61d85c3650f910e0180603b169205b4123e3d3/687474703a2f2f706f7365722e707567782e6f72672f7a68757a697869616e3532302f796969322d6d65696c697365617263682f646f776e6c6f616473)](https://packagist.org/packages/zhuzixian520/yii2-meilisearch) [![Latest Unstable Version](https://camo.githubusercontent.com/ee784cf1c0d32dc0dface0b64ce322d11d3162c1b817b8f895bf412455c91ce4/687474703a2f2f706f7365722e707567782e6f72672f7a68757a697869616e3532302f796969322d6d65696c697365617263682f762f756e737461626c65)](https://packagist.org/packages/zhuzixian520/yii2-meilisearch) [![License](https://camo.githubusercontent.com/f4b418e7634aee4c3981843e8dbf6673d01b75e1aaf29a6e2727bf8b316134a7/687474703a2f2f706f7365722e707567782e6f72672f7a68757a697869616e3532302f796969322d6d65696c697365617263682f6c6963656e7365)](https://packagist.org/packages/zhuzixian520/yii2-meilisearch) [![PHP Version Require](https://camo.githubusercontent.com/63cdc746733d5e7b73f66f4177eb7dd91c53d3897f4fa4ca5f77b35e93cabf13/687474703a2f2f706f7365722e707567782e6f72672f7a68757a697869616e3532302f796969322d6d65696c697365617263682f726571756972652f706870)](https://packagist.org/packages/zhuzixian520/yii2-meilisearch)[![Dependents](https://camo.githubusercontent.com/7235d742d776c1ce3b12295e07ecb603c8d7e0eb10df150e13c6af9ba1c100e5/687474703a2f2f706f7365722e707567782e6f72672f7a68757a697869616e3532302f796969322d6d65696c697365617263682f646570656e64656e7473)](https://packagist.org/packages/zhuzixian520/yii2-meilisearch)[![Suggesters](https://camo.githubusercontent.com/61cd47a8c3e9772fcc446f925644d481cef84ea30e71e6b09fd9de99313fd81f/687474703a2f2f706f7365722e707567782e6f72672f7a68757a697869616e3532302f796969322d6d65696c697365617263682f73756767657374657273)](https://packagist.org/packages/zhuzixian520/yii2-meilisearch)

English | [简体中文](./README.zh-CN.md) | [繁體中文](./README.zh-TW.md)
---------------------------------------------------------------

[](#english--简体中文--繁體中文)

This extension provides the MeiliSearch integration for the Yii framework 2.0.

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
composer require zhuzixian520/yii2-meilisearch

```

or add

```
"zhuzixian520/yii2-meilisearch": "^1.0"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

Once the extension is installed, simply use it in your code by :

```
return [
    'components' => [
        'meilisearch' => [
            'class' => zhuzixian520\meilisearch\Connection::class,
            'hostname' => 'localhost',
            'port' => 7700,
            //'apiKey' => 'your_master_key',
            //'useSSL' => false,
        ],
    ],
];
```

### Work with this component

[](#work-with-this-component)

```
$ms = \Yii::$app->meilisearch;

// Set API keys From your master Key
$ms->apiKey = 'xxxx';

$msc = $ms->createCommand();

//The health check endpoint enables you to periodically test the health of your Meilisearch instance
$msc->health;
```

### Indexes

[](#indexes)

```
//$res = $msc->allIndexes;
//$res = $msc->createIndex('movies', 'id');
//$res = $msc->updateIndex('movies', 'id');
//$res = $msc->deleteIndex('movies');
$msci = $msc->index('movies');
//$res = $msci->info;
//$res = $msci->update('id');
//$res = $msci->delete();
```

### Documents

[](#documents)

```
$res = $msci->getDocument(25684);
$res = $msci->getDocuments(['offset' => 0, 'limit' => 2, 'attributesToRetrieve' => '*']);
/*$file_name = Yii::getAlias('@app/runtime/') . 'movies.json';
$movies_json = file_get_contents($file_name);
$movies = json_decode($movies_json, true);
$res = $msci->addDocuments($movies,'id');*/
//$res = $msci->updateDocuments($movies,'id');
//$res = $msci->deleteAllDocuments();
//$res = $msci->deleteDocument(100);
//$res = $msci->deleteDocuments([10001, 100017]);
```

### Search

[](#search)

```
$res = $meilisearch->createCommand()->index('movies')->search(['q' => 'saw', 'limit' => 2,]);
var_dump($res);
```

### Task

[](#task)

```
$res = $msc->tasks;
$res = $msc->getTask(4);
$res = $msci->getTasks();
$res = $msci->getTask(8);
```

### Keys

[](#keys)

```
//$res = $msc->keys;
//$res = $msc->getKey('9bFPJSxkc0e7939d743e110b354fe3625876cfec14efb4301bf195f6aed4a57f1d9004fa');
/*$res = $msc->createKey([
'description' => 'Add documents: Products API key',
'actions' => ['documents.add'],
'indexes' => ['products'],
'expiresAt' => '2042-04-02T00:42:42Z',
]);*/
/*$res = $msc->updateKey('yKEcAaQX547e46c7d8eaa1224f6a5196c5c7a13f47932cbeb1ba06db962b379cb0ef19e4', [
'description' => 'Add documents: Products API key',
'actions' => ['documents.add'],
'indexes' => ['products'],
'expiresAt' => '2043-04-02T00:42:42Z',
]);*/
//$res = $msc->deleteKey('qAZlXnA191d328ea51fb26b822fecc556c38c0a3af1caa95962ede60a0155381a39a3a36');
```

### Settings

[](#settings)

```
$res = $msci->settings;
/*$res = $msci->updateSettings([
'displayedAttributes' => ['*'],
'distinctAttribute' => null,
'filterableAttributes' => [],
'rankingRules' => [
'words',
'typo',
'proximity',
'attribute',
'sort',
'exactness',
'release_date:desc',
'rank:desc'
],
'searchableAttributes' => ['*'],
'sortableAttributes' => [],
'stopWords' => [
'the',
'a',
'an'
],
'synonyms' => [
'wolverine' => ['xmen', 'logan'],
'logan' => ['wolverine']
]
]);*/
//$res = $msci->resetSettings();
//$res = $msci->displayedAttrs;
//$res = $msci->updateDisplayedAttrs(['*']);
//$res = $msci->resetDisplayedAttrs();
/*$res = $msci->distinctAttr;
$res = $msci->updateDistinctAttr('id');
$res = $msci->resetDistinctAttr();
$res = $msci->filterableAttrs;
$res = $msci->updateFilterableAttrs([]);
$res = $msci->resetFilterableAttrs();
$res = $msci->rankingRules;
$res = $msci->updateRankingRules([
'words',
'typo',
'proximity',
'attribute',
'sort',
'exactness',
'release_date:desc',
'rank:desc'
]);
$res = $msci->resetRankingRules();
$res = $msci->searchableAttrs;
$res = $msci->updateSearchableAttrs(['*']);
$res = $msci->resetSearchableAttrs();
$res = $msci->sortableAttrs;
$res = $msci->updateSortableAttrs([]);
$res = $msci->resetSortableAttrs();
$res = $msci->stopWords;
$res = $msci->updateStopWords([
'the',
'a',
'an'
]);
$res = $msci->resetStopWords();
$res = $msci->synonyms;
$res = $msci->updateSynonyms([
'wolverine' => ['xmen', 'logan'],
'logan' => ['wolverine']
]);
$res = $msci->resetSynonyms();*/
```

### Stats

[](#stats)

```
//$res = $msc->stats;
//$res = $msci->stats;
```

### Health

[](#health)

```
$msc->health;
```

### Version

[](#version)

```
$msc->version;
```

### Dumps

[](#dumps)

```
$res = $msc->createDump();
//$res = $msc->getDumpStatus('20220211-145911299');
var_dump($res);
```

Contact Us
----------

[](#contact-us)

> Email：

Sponsorship and donation:
-------------------------

[](#sponsorship-and-donation)

 [![](/images/wepay.jpg)](/images/wepay.jpg) [![](/images/alipay.jpg)](/images/alipay.jpg)

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1604d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/508df745ed44bd6036128dfd031e1a549315dc73580a33c154b68a429bee181d?d=identicon)[zhuzixian520](/maintainers/zhuzixian520)

---

Top Contributors

[![zhuzixian520](https://avatars.githubusercontent.com/u/16476541?v=4)](https://github.com/zhuzixian520 "zhuzixian520 (13 commits)")

---

Tags

meilisearchphpsearchyii2yii2extension

### Embed Badge

![Health badge](/badges/zhuzixian520-yii2-meilisearch/health.svg)

```
[![Health](https://phpackages.com/badges/zhuzixian520-yii2-meilisearch/health.svg)](https://phpackages.com/packages/zhuzixian520-yii2-meilisearch)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[skeeks/cms

SkeekS CMS — control panel and tools based on php framework Yii2

13825.8k59](/packages/skeeks-cms)[thrieu/yii2-grid-view-state

Save filters from GridView to session, keep the filter state between pages.

1313.7k1](/packages/thrieu-yii2-grid-view-state)[keygenqt/yii2-autocomplete-ajax

A simple way to search model id of the attributes model

1016.4k](/packages/keygenqt-yii2-autocomplete-ajax)[sammaye/yii2-solr

Solr plugin for the Yii2 framework built ontop of Solarium

1063.3k](/packages/sammaye-yii2-solr)[vxm/yii2-searchable

Simple full-text search for Yii2 active record

181.4k](/packages/vxm-yii2-searchable)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
