PHPackages                             dogmatic69/cakephp-sifter - 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. dogmatic69/cakephp-sifter

ActiveCakephp-plugin[Search &amp; Filtering](/categories/search)

dogmatic69/cakephp-sifter
=========================

CakePHP plugin for filtering and searching model data

17PHP

Since Feb 17Pushed 2y ago2 watchersCompare

[ Source](https://github.com/dogmatic69/cakephp-sifter)[ Packagist](https://packagist.org/packages/dogmatic69/cakephp-sifter)[ RSS](/packages/dogmatic69-cakephp-sifter/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

[![Build Status](https://camo.githubusercontent.com/f0d193f42b31bfc0d2ecf5b5f377c2de1802c75b3ca1ca3a3bbf190f8866271c/68747470733a2f2f7472617669732d63692e6f72672f646f676d6174696336392f63616b657068702d7369667465722e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/dogmatic69/cakephp-sifter)[![Coverage Status](https://camo.githubusercontent.com/b2c8f0448980cb4ad1ca5bf4c9aaed56270817ad30b87586ed2c256439d85c6d/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f646f676d6174696336392f63616b657068702d7369667465722f62616467652e706e67)](https://coveralls.io/r/dogmatic69/cakephp-sifter)

Sifter
------

[](#sifter)

Sifter is a CakePHP plugin that makes searching and filtering data simple. It can also be configured to change how it searches.

All configuration is done in the model, which means there is no need to mess about with forms, redirects or any other code. A component interacts with request data and does various things depening on the data found in the request.

Main Features:

- Automatic form generation based on the configuration in the model / behavior config. (using included element)
- Field type introspection for best input type
- Automatic ajax autocomplete on all text inputs (requires jQuery to be included)
- Automatic select dropdown for foreign key fields (including deep relations, with customisable find method setting)
- Automatic pagination modification so it can be dropped in with minimal code changes, can also be used with normal finds or manually
- Post -&gt; Redirect -&gt; Get so searches are indexable, linkable
- Security - Will only search configured fields in configured actions, additional fields are simply ignored
- Deep relation search, especially with custom finds doing the search it is possible to control all your joins and additional search requirements

The plugin is made up of the following main sections:

### Behavior

[](#behavior)

The behavior does a number of things:

- Figure out the form inputs based on the field schema
- Find and call custom find methods in the model for fetching data
- Configure what is searched and where

### Component

[](#component)

- catch requests and either redirect POST -&gt; GET or fetch data for ajax autocomplete
- fetch and set data for view variables to populate selects in the search form
- filter GET params and modify / return find conditions

### Helper / element

[](#helper--element)

This is the frontend to the Sifter plugin. This is totaly optional but should cover most usage cases. If you are not going to use the included element for the search form you should at least look at if for ideas as to what is required to make the search work.

- Element: Search form default based on configured model and settings
- Helper: Convert behavior settings into Form inputs

Install
-------

[](#install)

Install with git

```
git clone https://github.com/dogmatic69/cakephp-sifter Plugin/Sifter

```

Install as a submodule

```
git submodule add https://github.com/dogmatic69/cakephp-sifter Plugin/Sifter

```

Install with composer (comming soon)

```
composer.phar require dogmatic69/cakephp-sifter

```

Basic usage
-----------

[](#basic-usage)

Attach the behavior to the model you would like to sift. This can be done in the actsAs property or dynamically, see the CakePHP docs for more details.

```
class MyModel extends AppModel {
	public $actsAs = array(
		... other behaviors
		'Sifter.Sifter' => array(
			'fields' => array(
				'MyModel.field_1' => array(
					'input' => array(
						'placeholder' => 'Customize your form with ease',
					)
				),
				'MyOtherModel.field_2',
				'field_3', // element('Sifter.sift');

```

That is it, now when you visit the page you should see a search form. Submitting data on in the form will do a PRG to to a URL containing all your params. If you are using pagination these will be included already in the `PaginatorComponent::$settings` property. If you are using a normal find on the page you can use the `SifterComponent::sift()` method to fetch the query conditions.

In a controller method:

```
$conditions = $this->Sifter->sift($this);
pr($conditions);

// output
array(
	'conditions' => array(
		'MyModel.field_1' => 'foobar',
		'MyOtherModel.field_2' => 'baz',
		...
	),
	'contain' => array(
		'MyOtherModel',
	)
)

```

Contribute
----------

[](#contribute)

Submit bugs / patches on github.com/dogmatic69/cakephp-sifter

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity43

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/206f2efaac7910794808a675fcbd0c79be1ef794ada8a59a05f1c5de46774d1f?d=identicon)[dogmatic69](/maintainers/dogmatic69)

---

Top Contributors

[![dogmatic69](https://avatars.githubusercontent.com/u/94674?v=4)](https://github.com/dogmatic69 "dogmatic69 (44 commits)")

### Embed Badge

![Health badge](/badges/dogmatic69-cakephp-sifter/health.svg)

```
[![Health](https://phpackages.com/badges/dogmatic69-cakephp-sifter/health.svg)](https://phpackages.com/packages/dogmatic69-cakephp-sifter)
```

###  Alternatives

[ruflin/elastica

Elasticsearch Client

2.3k50.4M203](/packages/ruflin-elastica)[opensearch-project/opensearch-php

PHP Client for OpenSearch

15024.3M65](/packages/opensearch-project-opensearch-php)[mailerlite/laravel-elasticsearch

An easy way to use the official PHP ElasticSearch client in your Laravel applications.

934529.3k2](/packages/mailerlite-laravel-elasticsearch)[massive/search-bundle

Massive Search Bundle

721.4M13](/packages/massive-search-bundle)[shyim/opensearch-php-dsl

OpenSearch/Elasticsearch DSL library

175.9M9](/packages/shyim-opensearch-php-dsl)[outl1ne/nova-multiselect-filter

Multiselect filter for Laravel Nova.

45802.7k3](/packages/outl1ne-nova-multiselect-filter)

PHPackages © 2026

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