PHPackages                             ychapard/cakephp3-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. ychapard/cakephp3-search

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

ychapard/cakephp3-search
========================

fork from

0671[1 PRs](https://github.com/ychapard/cakephp3-search/pulls)PHP

Since Jul 3Pushed 8y ago1 watchersCompare

[ Source](https://github.com/ychapard/cakephp3-search)[ Packagist](https://packagist.org/packages/ychapard/cakephp3-search)[ RSS](/packages/ychapard-cakephp3-search/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

CakePHP Search
==============

[](#cakephp-search)

Search provides a search module for CakePHP applications. Added :

- A field ( search\_data default) is automatically filled with the values ​​of the fields you want to index
- Search word is separated into words (space char) so search is base on multiples words

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

[](#requirements)

The master branch has the following requirements:

- CakePHP 3.0.0 or greater.
- PHP 5.4.16 or greater.
- SQLite or another database driver that CakePHP can talk to. By default DebugKit will use SQLite, if you need to use a different database see the Database Configuration section below.

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

[](#installation)

- Install the plugin with composer from your CakePHP Project's ROOT directory (where composer.json file is located)

```
php composer.phar require ychapard/cakephp3-search "dev-master"
```

- Load the plugin by adding following to your `config/bootstrap.php`

```
Plugin::load('Search');
```

or running command

```
./bin/cake plugin load Search
```

Usage
-----

[](#usage)

- Add a search config method in your table

```
use Search\Manager;

...

public function searchConfiguration()
{
    $search = new Manager($this);
    $search
    ->value('author_id', [
        'field' => $this->aliasField('author_id')
    ])
    ->like('q', [
        'before' => true,
        'after' => true,
        'field' => [$this->aliasField('title'), $this->aliasField('title')]
    ]);
    return $search;
}
```

- Add The Behavior in your initialize method

```
public function initialize(array $config)
{
    ...
    $this->addBehavior('Search.Search',[
        'field' => ['name','title','short_text'],
        'dest_field' => 'search_data',
        'replacement' => ' '
    ]);
    ...
}
```

- Example of index controller for a model `Article`

```
public function index()
{
    $query = $this->Countries
        ->find('search', $this->Articles->filterParams($this->request->query))
        ->where(['title !=' => null])
        ->order(['Article.id' => 'asc'])
        ->contain([
            'Comments'
        ]);
    $this->set('articles', $this->paginate($query));
}
```

The `search` finder and the `filterParams()` method are dynamically provided by the `Search` behavior.

- Then add the component search in the necessary methods (for our example index)

```
public function index()
{
    $this->loadComponent('Search.Prg');
}
```

- Instead, you can add this in your AppController to enable component in all index methods

```
public function initialize()
{
    parent::initialize();
    if ($this->request->action === 'index') {
        $this->loadComponent('Search.Prg');
    }
}
```

Filtering your data
-------------------

[](#filtering-your-data)

Once you have completed all the setup you can now filter your data by passing query params in your index method. Using the Article example given above, you could filter your articles using the following.

`example.com/articles?q=cakephp`

Would filter your list of articles to any article with "cakephp" in the `title`or `content` field. You might choose to make a `get` form which posts the filter directly to the url, or create links manually.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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/3138c58ec5e94ee99eeaaa4a3d362f77e31cd94ec5b400a9444f921f1c983ae8?d=identicon)[ychapard](/maintainers/ychapard)

---

Top Contributors

[![jippi](https://avatars.githubusercontent.com/u/22841?v=4)](https://github.com/jippi "jippi (22 commits)")[![ADmad](https://avatars.githubusercontent.com/u/142658?v=4)](https://github.com/ADmad "ADmad (16 commits)")[![cake17](https://avatars.githubusercontent.com/u/1652972?v=4)](https://github.com/cake17 "cake17 (9 commits)")[![lorenzo](https://avatars.githubusercontent.com/u/37621?v=4)](https://github.com/lorenzo "lorenzo (8 commits)")[![ychapard](https://avatars.githubusercontent.com/u/11046787?v=4)](https://github.com/ychapard "ychapard (6 commits)")[![davidyell](https://avatars.githubusercontent.com/u/49889?v=4)](https://github.com/davidyell "davidyell (3 commits)")[![jadb](https://avatars.githubusercontent.com/u/33527?v=4)](https://github.com/jadb "jadb (2 commits)")[![steefaan](https://avatars.githubusercontent.com/u/5982785?v=4)](https://github.com/steefaan "steefaan (1 commits)")[![AD7six](https://avatars.githubusercontent.com/u/33387?v=4)](https://github.com/AD7six "AD7six (1 commits)")

### Embed Badge

![Health badge](/badges/ychapard-cakephp3-search/health.svg)

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

###  Alternatives

[shyim/opensearch-php-dsl

OpenSearch/Elasticsearch DSL library

186.7M12](/packages/shyim-opensearch-php-dsl)[awesome-nova/dependent-filter

Dependent filters for Laravel Nova

26190.2k](/packages/awesome-nova-dependent-filter)

PHPackages © 2026

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