PHPackages                             imponeer/criteria - 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. [Database &amp; ORM](/categories/database)
4. /
5. imponeer/criteria

ActiveLibrary[Database &amp; ORM](/categories/database)

imponeer/criteria
=================

Small library for building database criteria strings

v2.0.3(5mo ago)020.0k↓33.3%1MITPHPPHP &gt;=8.3CI failing

Since Feb 25Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/imponeer/criteria)[ Packagist](https://packagist.org/packages/imponeer/criteria)[ RSS](/packages/imponeer-criteria/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (15)Used By (0)

[![License](https://camo.githubusercontent.com/08b1a4b8c5d89622888ad92538a0e270fcfbc6fda452ac56adc44449735d3bbb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f696d706f6e6565722f63726974657269612e737667)](LICENSE)[![GitHub release](https://camo.githubusercontent.com/2396ba22ccc82d67eed118a6c2056200d9efaed3717fd1d68dfd387e6aac3804/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f696d706f6e6565722f63726974657269612e737667)](https://github.com/imponeer/criteria/releases) [![PHP](https://camo.githubusercontent.com/9c4b6277d7dc0626fb73fb4a7b2b157141cf7b87aaf89be3a56f02c9ac0c5858/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f696d706f6e6565722f63726974657269612e737667)](http://php.net)[![Packagist](https://camo.githubusercontent.com/8b9f960517463ef3ff9089ab8973d274d223bbdef0e1d16303b65fff612c0608/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f696d706f6e6565722f63726974657269612e737667)](https://packagist.org/packages/imponeer/criteria)

Criteria
========

[](#criteria)

A small PHP library to generate SQL *WHERE*, *ORDER BY*, and *GROUP BY* query parts. Inspired by [Xoops](//xoops.org) CMS classes ([CriteriaElement](https://github.com/XOOPS/XoopsCore/blob/b6c8582ef294f85bde7e8e48f7475c1d36284c5e/xoops_lib/Xoops/Core/Kernel/CriteriaElement.php), [Criteria](https://github.com/XOOPS/XoopsCore/blob/b6c8582ef294f85bde7e8e48f7475c1d36284c5e/xoops_lib/Xoops/Core/Kernel/Criteria.php), and [CriteriaCompo](https://github.com/XOOPS/XoopsCore/blob/b6c8582ef294f85bde7e8e48f7475c1d36284c5e/xoops_lib/Xoops/Core/Kernel/CriteriaCompo.php)), but fully rewritten and released under a more permissive open-source [license](LICENSE).

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

[](#installation)

The recommended way to install this package is via [Composer](https://getcomposer.org):

```
composer require imponeer/criteria
```

Alternatively, you can manually include the files from the `src/` directory.

Usage
-----

[](#usage)

Here is a basic example of how to use the Criteria library:

```
use Imponeer\Database\Criteria\CriteriaItem;
use Imponeer\Database\Criteria\CriteriaCompo;

$criteria = new CriteriaCompo();
$criteria->add(new CriteriaItem('status', 'active'));
$criteria->add(new CriteriaItem('age', 18, '>='));

// Generate SQL WHERE clause
$where = $criteria->render();
// $where will be: "(`status` = 'active' AND `age` >= 18)"
```

API Documentation
-----------------

[](#api-documentation)

Full API documentation is available in the [repository wiki](https://github.com/imponeer/criteria/wiki). Documentation is automatically updated with every release.

Development
-----------

[](#development)

For development, use the following Composer commands:

- Run tests: ```
    composer test
    ```
- Run static analysis: ```
    composer phpstan
    ```
- Run code style checks: ```
    composer phpcs
    ```

How to contribute?
------------------

[](#how-to-contribute)

If you want to add functionality or fix bugs, fork the repository, make your changes, and create a pull request.

If you find any bugs or have questions, please use the [issues tab](https://github.com/imponeer/criteria/issues) to report them or ask questions.

###  Health Score

53

—

FairBetter than 97% of packages

Maintenance82

Actively maintained with recent releases

Popularity24

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 68.6% 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 ~144 days

Recently: every ~221 days

Total

13

Last Release

168d ago

Major Versions

v1.0.8 → v2.0.02025-06-03

PHP version history (3 changes)v1.0.0PHP &gt;=7.3

v1.0.6PHP ^7.3 || ^8.0

v2.0.0PHP &gt;=8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/dba53e399a507d1f60626164c8b1e340a5cc0dc4f0637f4c6aaff8fc239fdaee?d=identicon)[fiammybe](/maintainers/fiammybe)

![](https://www.gravatar.com/avatar/7255f306e0ca27292c50cdd9644c1c04e0d7b0f54bf35e0cdd79dc55c83b4923?d=identicon)[MekDrop](/maintainers/MekDrop)

![](https://www.gravatar.com/avatar/79009323fafcd4974bb1713b12eea0a610f01c4fb21cc5e85d446c4cb66453d4?d=identicon)[skenow](/maintainers/skenow)

---

Top Contributors

[![MekDrop](https://avatars.githubusercontent.com/u/342641?v=4)](https://github.com/MekDrop "MekDrop (59 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (21 commits)")[![fiammybe](https://avatars.githubusercontent.com/u/3736946?v=4)](https://github.com/fiammybe "fiammybe (3 commits)")[![Codex](https://avatars.githubusercontent.com/in/2248422?v=4)](https://github.com/Codex "Codex (2 commits)")[![mend-bolt-for-github[bot]](https://avatars.githubusercontent.com/in/16809?v=4)](https://github.com/mend-bolt-for-github[bot] "mend-bolt-for-github[bot] (1 commits)")

---

Tags

criteriadatabasehacktoberfestdatabasecriteriaxoops

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/imponeer-criteria/health.svg)

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

###  Alternatives

[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k578.4M5.6k](/packages/doctrine-dbal)[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[doctrine/doctrine-bundle

Symfony DoctrineBundle

4.8k241.3M3.3k](/packages/doctrine-doctrine-bundle)[doctrine/migrations

PHP Doctrine Migrations project offer additional functionality on top of the database abstraction layer (DBAL) for versioning your database schema and easily deploying changes to it. It is a very easy to use and a powerful tool.

4.8k204.8M440](/packages/doctrine-migrations)[doctrine/data-fixtures

Data Fixtures for all Doctrine Object Managers

2.9k136.1M516](/packages/doctrine-data-fixtures)[robmorgan/phinx

Phinx makes it ridiculously easy to manage the database migrations for your PHP app.

4.5k46.2M405](/packages/robmorgan-phinx)

PHPackages © 2026

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