PHPackages                             olegstepura/doctrine-multicolumn-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. olegstepura/doctrine-multicolumn-search

ActiveLibrary[Search &amp; Filtering](/categories/search)

olegstepura/doctrine-multicolumn-search
=======================================

Simply search multiple Doctrine ORM entities for a user query

5681PHP

Since Apr 23Pushed 14y ago1 watchersCompare

[ Source](https://github.com/olegstepura/doctrine-multicolumn-search)[ Packagist](https://packagist.org/packages/olegstepura/doctrine-multicolumn-search)[ RSS](/packages/olegstepura-doctrine-multicolumn-search/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

MultiColumnSearch
=================

[](#multicolumnsearch)

Simply search multiple entities for a user query.

Description
-----------

[](#description)

This is a query builder for Doctrine ORM designed to create a query for use with [Pagerfanta](https://github.com/whiteoctober/Pagerfanta). The created query searches any number of columns for a given query which is exploded into words and queried the way that all words must be included in the result row. Sql substitute character (%) may be included. It is written on PHP and intended to be used with Doctrine [Doctrine ORM](http://www.doctrine-project.org/projects/orm).

Description, again ;)
---------------------

[](#description-again-)

The search queries are not matched against one single column in database (as usual), but against several of them. So when you type 2 words searching for user in user database not only user name is searched, but also user email, second name and maybe description can be inspected to match the searched words. What columns to match is up to you and is configurable.

Lets assume you have a database table with all the users of your system.

```
+----+-------------+--------------+-----------------------+
| id | name        | last_name    | email                 |
+----+-------------+--------------+-----------------------+
| 1  |    Leonardo | DiCaprio     | strange@mailhost.com  |
| 2  |        John | Doe          | john.doe@leonardo.ru  |
| 3  |        Bill | Gates        | bill@gates.it         |
| 4  |        Will | Leonardo     | will@leo.com          |
| 5  | Leonardo123 | De Niro      | leo@deniro.de         |
+----+-------------+--------------+-----------------------+

```

Searching for "leonardo" will produce records 1, 2, 4 and 5. Searching for "leo com" will produce records 1, 2, 4 and 5. Searching for "bill com" will produce records 1, 3 and 4.

Usage example
-------------

[](#usage-example)

Properties in given class are inspected with annotation reader for the ones marked with `\Ost\Doctrine\MultiColumnSearch\Searchable` annotation.

Here is an example of entity (it can be found in tests folder):

```
/**
 * User class.
 * @ORM\Entity
 * @ORM\Table(name="user")
 * @author Oleg Stepura
 * @version 1.0
 */
class User
{
	/**
	 * @ORM\Column(name="id")
	 * @ORM\Id
	 * @ORM\GeneratedValue
	 * @var int $id
	 */
	private $id;

	/**
	 * @ORM\Column(name="name", type="string", length=64)
	 * @Searchable
	 * @var string $name
	 */
	private $name = '';

	/**
	 * @ORM\Column(name="email", type="string", length=255)
	 * @Searchable
	 * @var string $email
	 */
	private $email = '';

	/**
	 * @ORM\Column(name="password", type="string", length=40)
	 * @var string $password
	 */
	private $password = '';
}

```

And here is usage example.

```
use Pagerfanta\Pagerfanta;
use Pagerfanta\Adapter\DoctrineORMAdapter;
use Doctrine\Common\Annotations\Reader;

$reader = new IndexedReader(new AnnotationReader());
$qb = new QueryBuilder($entityManager, $reader, __NAMESPACE__ . '\\User');
$pagerfanta = new Pagerfanta($qb->getPagerfantaAdapter('my query'));

// use Pagerfanta the usual way
$currentPageResults = $pagerfanta->getCurrentPageResults();

```

Configured with Symfony Dependency Injection even easier:

```
$container
	->get('ost.doctrine.multicolumn_search.builder_factory')
	->createBuilder('\\User')
	->getPagerfanta('my query');

```

License
-------

[](#license)

The work is provided as is for free without any support guarantee under the [Creative Commons CC-BY-SA](http://creativecommons.org/licenses/by-sa/3.0/) license.

Author
------

[](#author)

The work was made by Oleg Stepura. If you have questions feel free to contact me at github \[-at-\] oleg.stepura.com

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

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/b7df470dc3784a669ab4444b341d858530fe7663da2407607cf4908685053032?d=identicon)[olegstepura](/maintainers/olegstepura)

---

Top Contributors

[![olegstepura](https://avatars.githubusercontent.com/u/534510?v=4)](https://github.com/olegstepura "olegstepura (5 commits)")

### Embed Badge

![Health badge](/badges/olegstepura-doctrine-multicolumn-search/health.svg)

```
[![Health](https://phpackages.com/badges/olegstepura-doctrine-multicolumn-search/health.svg)](https://phpackages.com/packages/olegstepura-doctrine-multicolumn-search)
```

###  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)[outl1ne/nova-multiselect-filter

Multiselect filter for Laravel Nova.

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

a general purpose text search engine written entirely in PHP 5

39921.0k35](/packages/handcraftedinthealps-zendsearch)

PHPackages © 2026

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