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

Abandoned → [grizz-it/search](/?search=grizz-it%2Fsearch)ArchivedLibrary[Search &amp; Filtering](/categories/search)

ulrack/search
=============

Search objects for Ulrack.

2.0.1(6y ago)128MITPHPPHP ^7.2

Since Mar 4Pushed 6y ago1 watchersCompare

[ Source](https://github.com/ulrack/search)[ Packagist](https://packagist.org/packages/ulrack/search)[ RSS](/packages/ulrack-search/feed)WikiDiscussions master Synced 3d ago

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

DEPRECATION NOTICE: this package has been moved and improved at [grizz-it/search](https://github.com/grizz-it/search)
=====================================================================================================================

[](#deprecation-notice-this-package-has-been-moved-and-improved-at-grizz-itsearch)

[![Build Status](https://camo.githubusercontent.com/1f5103781fb43935b4326fb2b00e734362f141a367d883546c87b80d620ef9dd/68747470733a2f2f7472617669732d63692e636f6d2f756c7261636b2f7365617263682e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/ulrack/search)

Ulrack Search
=============

[](#ulrack-search)

Ulrack Search is an implementation of search criteria for applications. It tries to talk to data in application through a common interface.

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

[](#installation)

To install the package run the following command:

```
composer require ulrack/search

```

Usage
-----

[](#usage)

### Search Criteria Compilers

[](#search-criteria-compilers)

Search criteria compilers are used to compile a filled search criteria object. The output can be used by a package apply the search criteria to the data query.

There is no implementation provided in this package for a compiler. This is because it is application specific.

A search criteria compiler can be created by extending the `\Ulrack\Search\Common\SearchCriteriaCompilerInterface`. The implementation expects one function `compile`. The function accepts a `\Ulrack\Search\Common\SearchCriteriaInterface` object as an argument. This object should then be compiled to whatever the application expects.

### Search Criteria

[](#search-criteria)

Search criteria objects are build on the `\Ulrack\Search\Common\SearchCriteriaInterface`. These objects group all underlying search related objects by getting these injected.

The implementation is provided in the class `\Ulrack\Search\Component\Criteria\SearchCriteria`.

The `SearchCriteria` object can receive and retrieve the following objects:

- `\Ulrack\Search\Common\FilterGroupInterface`Can be added by calling: `addFilterGroup` with the `FilterGroup` as an argument. Can be retrieved by calling: `getFilterGroups` and will return an array of `FilterGroups`.
- `\Ulrack\Search\Common\LimiterInterface`Can be added by calling: `addLimiter` with the `Limiter` as an argument. Can be retrieved by calling: `getLimiters` and will return an array of `Limiters`.
- `\Ulrack\Search\Common\PagerInterface`Can be added by calling: `addPager` with the `Pager` as an argument. Can be retrieved by calling: `getPagers` and will return an array of `Pagers`.
- `\Ulrack\Search\Common\SorterInterface`Can be added by calling: `addSorter` with the `Sorter` as an argument. Can be retrieved by calling: `getSorters` and will return an array of `Sorters`.

### Filter Groups

[](#filter-groups)

Filter groups are used to combine filters into one (in the case of SQL `AND` separated) group of filters. Multiple `FilterGroups` on a `SearchCriteria` would result in (in the case of SQL) `OR` separated filters.

A `Filter` can be added to the filter group by calling: `addFilter`. It accepts an instance of `\Ulrack\Search\Common\FilterInterface` as its argument. To retrieve the added `Filters` in an array, the function `getFilters` can be called.

### Filters

[](#filters)

Filters are used to narrow down the results of a request by matching values to a field with a comparator.

Filters expect their arguments in the constructor. The first argument expects a field for the filter. The second argument expects a comparator, which should be one of of the following out of the `\Ulrack\Search\Common\FilterInterface`:

- `FilterInterface::COMPARATOR_EQ`Equals comparator "=". Checks if the field equals the value.
- `FilterInterface::COMPARATOR_NEQ`Not equals comparator "!=". Checks if the field does not equal the value.
- `FilterInterface::COMPARATOR_GT`Greater than comparator "&gt;". Check if the field is greater than the value.
- `FilterInterface::COMPARATOR_GTEQ`Greater than or equals comparator "&gt;=". Checks if the field is greater than or equals the value.
- `FilterInterface::COMPARATOR_LT`Less than comparator "&lt;". Check if the field is less than the value.
- `FilterInterface::COMPARATOR_LTEQ`Less than or equals comparator "&lt;=". Checks if the field is less than or equals the value.
- `FilterInterface::COMPARATOR_IN`In comparator. Checks if the field occurs in the value.
- `FilterInterface::COMPARATOR_NIN`Not in comparator. Checks if the field does not occur in the value.
- `FilterInterface::COMPARATOR_LIKE`Like comparator. Checks if the field looks like the value.
- `FilterInterface::COMPARATOR_NOT`Not comparator. Checks if the field is not like the value. Can be used for example in a query for a NOT NULL statement.

The third argument expects the value which should be compared.

The field can be retrieved with the `getField` function. The comparator can be retrieved with the `getComparator` function. The value can be retrieved with the `getValue` function.

### Limiters

[](#limiters)

Limiters are used to reduce the size of the result.

Limiters expect their arguments in the constructor. One variadic argument can be supplied which consists of the fields.

The fields can be retrieved with the `getFields` function.

### Pagers

[](#pagers)

Pagers are used to retrieve a section of the results.

Pagers expect their arguments in the constructor. The first argument of a `Pager` expects an integer which indicates the page. The second argument of a `Pager` expects an integer which determines the page size.

The page can be retrieved with the function `getPage`. The size can be retrieved with the function `getSize`.

### Sorters

[](#sorters)

Sorters are used to sort the results of a data request.

Sorters expect their arguments in the constructor. The first argument of a `Sorter` expects a string which indicates the field. The second argument of a `Sorter` expects a string which indicates the direction.

The direction can be one of the following from the `\Ulrack\Search\Common\SorterInterface`:

- `SorterInterface::DIRECTION_ASC`This sets the sorting pattern to ascending.
- `SorterInterface::DIRECTION_DESC`This sets the sorting pattern to descending.

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

MIT License
-----------

[](#mit-license)

Copyright (c) 2019 GrizzIT

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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.

###  Release Activity

Cadence

Every ~122 days

Total

4

Last Release

2261d ago

Major Versions

1.0.1 → 2.0.02019-11-10

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8682881?v=4)[GrizzIT](/maintainers/GrizzIT)[@grizzit](https://github.com/grizzit)

---

Top Contributors

[![mfrankruijter](https://avatars.githubusercontent.com/u/8653925?v=4)](https://github.com/mfrankruijter "mfrankruijter (6 commits)")

---

Tags

phpsearchsearch-criteriaulracksearch

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[elasticsearch/elasticsearch

PHP Client for Elasticsearch

5.3k178.3M943](/packages/elasticsearch-elasticsearch)[ruflin/elastica

Elasticsearch Client

2.3k50.4M203](/packages/ruflin-elastica)[solarium/solarium

PHP Solr client

93532.7M98](/packages/solarium-solarium)[titasgailius/search-relations

A Laravel Nova tool.

3587.2M4](/packages/titasgailius-search-relations)[opensearch-project/opensearch-php

PHP Client for OpenSearch

15024.3M65](/packages/opensearch-project-opensearch-php)[jsq/amazon-es-php

Support for using IAM authentication with the official Elasticsearch PHP client

9310.6M13](/packages/jsq-amazon-es-php)

PHPackages © 2026

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