PHPackages                             yii2tech/ar-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. yii2tech/ar-search

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

yii2tech/ar-search
==================

Provides unified search model for Yii ActiveRecord

1.0.1(6y ago)328.6k↓85%5BSD-3-ClausePHP

Since Apr 9Pushed 6y ago1 watchersCompare

[ Source](https://github.com/yii2tech/ar-search)[ Packagist](https://packagist.org/packages/yii2tech/ar-search)[ GitHub Sponsors](https://github.com/klimov-paul)[ Patreon](https://www.patreon.com/klimov_paul)[ RSS](/packages/yii2tech-ar-search/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (3)Used By (0)

 [ ![](https://avatars2.githubusercontent.com/u/12951949) ](https://github.com/yii2tech)

ActiveRecord Search Model Extension for Yii2
============================================

[](#activerecord-search-model-extension-for-yii2)

This extension provides unified search model for Yii ActiveRecord.

For license information check the [LICENSE](LICENSE.md)-file.

[![Latest Stable Version](https://camo.githubusercontent.com/64db64324023804779052993f4aea3b09357cb2881ff3a8a6fbe419300cabd97/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f79696932746563682f61722d7365617263682e737667)](https://packagist.org/packages/yii2tech/ar-search)[![Total Downloads](https://camo.githubusercontent.com/1b5c11ff1fe6cfdb7fe1b5ad7b3c87e28d2ae2f248c52ab65b7181a71f42b11c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f79696932746563682f61722d7365617263682e737667)](https://packagist.org/packages/yii2tech/ar-search)[![Build Status](https://camo.githubusercontent.com/72e75aacd202b7bdbe0fdac72d246da3fb43c6545109d1cfced03237b804c40e/68747470733a2f2f7472617669732d63692e6f72672f79696932746563682f61722d7365617263682e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/yii2tech/ar-search)

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

[](#installation)

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

Either run

```
php composer.phar require --prefer-dist yii2tech/ar-search

```

or add

```
"yii2tech/ar-search": "*"
```

to the require section of your composer.json.

Usage
-----

[](#usage)

This extension provides unified search model for Yii ActiveRecord via special model class - `\yii2tech\ar\search\ActiveSearchModel`.

This model is able to fetch its attributes, validation rules and filtering logic from the 'slave' source ActiveRecord model specified via `\yii2tech\ar\search\ActiveSearchModel::$model`. Thus you do not need to declare a separated model class for searching and define a filter logic. For example:

```
