PHPackages                             vintage/yii2-search - 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. vintage/yii2-search

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

vintage/yii2-search
===================

Search in Active Record models for Yii2

v2.0.0(8y ago)294.6k6[1 issues](https://github.com/Vintage-web-production/yii2-search/issues)BSD-3-ClausePHP

Since Aug 11Pushed 8y ago3 watchersCompare

[ Source](https://github.com/Vintage-web-production/yii2-search)[ Packagist](https://packagist.org/packages/vintage/yii2-search)[ RSS](/packages/vintage-yii2-search/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (2)Versions (5)Used By (0)

 [ ![](https://avatars1.githubusercontent.com/u/25753250) ](https://github.com/Vintage-web-production)

Search in Active Record models for Yii2
=======================================

[](#search-in-active-record-models-for-yii2)

[![Build Status](https://camo.githubusercontent.com/425a7e10dd0dc56e7fb75902bf09bf8858632c3c6c32a7a66d888f27bae5b109/68747470733a2f2f7472617669732d63692e6f72672f56696e746167652d7765622d70726f64756374696f6e2f796969322d7365617263682e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Vintage-web-production/yii2-search)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/9fb39eb182d666b2b5cbefd4bbcfa944e3f9752989f7cadc1e573411a1b7da8d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f56696e746167652d7765622d70726f64756374696f6e2f796969322d7365617263682f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Vintage-web-production/yii2-search/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/0b61b7430c5e05aac483059080f6546d24d1c741aa52cf6d424fe34c77b7a8f6/68747470733a2f2f706f7365722e707567782e6f72672f76696e746167652f796969322d7365617263682f646f776e6c6f616473)](https://packagist.org/packages/vintage/yii2-search)[![Latest Stable Version](https://camo.githubusercontent.com/df0e33896f5d16ee26ef0b90b55ea21ecbeeda4ff6aaefddfab77036ee6de88d/68747470733a2f2f706f7365722e707567782e6f72672f76696e746167652f796969322d7365617263682f762f737461626c65)](CHANGELOG.md)[![Latest Unstable Version](https://camo.githubusercontent.com/68d3cb9600e87d62c7bc3d596c2cf35fb67181cfc2c98102907d0ca472d1ce20/68747470733a2f2f706f7365722e707567782e6f72672f76696e746167652f796969322d7365617263682f762f756e737461626c65)](CHANGELOG.md)

This is component for searching in the Active Record models for Yii2 Framework.

Documentation is at [docs/guide/README.md](docs/guide/README.md).

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

[](#installation)

#### Install package

[](#install-package)

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

Either run

```
$ composer require vintage/yii2-search

```

or add

```
"vintage/yii2-search": "~2.0"

```

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

Usage
-----

[](#usage)

Implement `\vintage\search\interfaces\SearchInterface` interface in Active Record models

```
/**
 * Article search model.
 *
 * @property integer $id
 * @property string $title
 * @property string $short_description
 * @property string $content
 */
class ArticleSearch extends ActiveRecord implements \vintage\search\interfaces\SearchInterface
{
    /**
     * @inheritdoc
     */
    public function getSearchTitle()
    {

        return $this->title;
    }

    /**
     * @inheritdoc
     */
    public function getSearchDescription()
    {
        return $this->short_description;
    }

    /**
     * @inheritdoc
     */
    public function getSearchUrl()
    {
       return Url::toRoute(['/news/default/index', 'id' => $this->id]);
    }

   /**
    * @inheritdoc
    */
    public function getSearchFields()
    {
        return [
            'title',
            'short_description',
            'content',
        ];
    }
}
```

Call method of search component with a query

```
/* @var \vintage\search\models\SearchResult[] $result */
$result = Yii::$app->get('searcher')->search('some query here');
```

this method returns array of `\vintage\search\models\SearchResult` objects.

Tests
-----

[](#tests)

You can run tests with composer command

```
$ composer test

```

or using following command

```
$ codecept build && codecept run

```

Contributing
------------

[](#contributing)

For information about contributing please read [CONTRIBUTING.md](CONTRIBUTING.md).

Licence
-------

[](#licence)

[![License](https://camo.githubusercontent.com/53de3607c3efe9e90e6ec917394d7b1e9464e5fba24518aa61d0a308f445e6ff/68747470733a2f2f706f7365722e707567782e6f72672f76696e746167652f796969322d7365617263682f6c6963656e7365)](LICENSE)

This project is released under the terms of the BSD-3-Clause [license](LICENSE).

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 95.7% 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

Every ~61 days

Total

4

Last Release

3062d ago

Major Versions

1.1.0 → 2.0.x-dev2018-02-09

### Community

Maintainers

![](https://www.gravatar.com/avatar/22162d77618ce0d31a3280f4645890120b52c41dac52432192bc0ea0119bd65f?d=identicon)[Vintage-web-production](/maintainers/Vintage-web-production)

---

Top Contributors

[![greeflas](https://avatars.githubusercontent.com/u/17636915?v=4)](https://github.com/greeflas "greeflas (44 commits)")[![developer-av](https://avatars.githubusercontent.com/u/15675868?v=4)](https://github.com/developer-av "developer-av (1 commits)")[![Palyanitsaaa](https://avatars.githubusercontent.com/u/7643331?v=4)](https://github.com/Palyanitsaaa "Palyanitsaaa (1 commits)")

---

Tags

active-recordsearchsearch-algorithmsearching-algorithmsyii2yii2-extensionsearchyii2active-recordcomponent

###  Code Quality

TestsCodeception

### Embed Badge

![Health badge](/badges/vintage-yii2-search/health.svg)

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

PHPackages © 2026

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