PHPackages                             otobank/phpstan-doctrine-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. otobank/phpstan-doctrine-criteria

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

otobank/phpstan-doctrine-criteria
=================================

Doctrine Criteria extensions for PHPStan

0.6.0(4mo ago)255.5k↓70.5%1MITPHPPHP ^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0CI failing

Since Feb 24Pushed 4mo ago13 watchersCompare

[ Source](https://github.com/otobank/phpstan-doctrine-criteria)[ Packagist](https://packagist.org/packages/otobank/phpstan-doctrine-criteria)[ RSS](/packages/otobank-phpstan-doctrine-criteria/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (14)Versions (10)Used By (0)

Doctrine Criteria extensions for PHPStan
========================================

[](#doctrine-criteria-extensions-for-phpstan)

This extension provides following features:

- Validates entity fields to which criteria is applied.
- Depends on [phpstan-doctrine](https://github.com/phpstan/phpstan-doctrine), and includes its features.

Usage
-----

[](#usage)

```
composer require otobank/doctrine-target-aware-criteria
composer require --dev otobank/phpstan-doctrine-criteria

```

```
includes:
    - vendor/otobank/phpstan-doctrine-criteria/extension.neon
    - vendor/otobank/phpstan-doctrine-criteria/rules.neon
```

Configuration
-------------

[](#configuration)

```
parameters:
    doctrine:
        objectManagerLoader: bootstrap/phpstan_doctrine_manager.php
```

See:

You must use custom criteria.
-----------------------------

[](#you-must-use-custom-criteria)

`FooCriteria`

```
namespace App\Criteria;

use App\Entity\Foo;
use Otobank\PHPStan\Doctrine\Criteria;

class FooCriteria extends Criteria
{
    public static function getTargetClass() : string
    {
        return Foo::class;
    }
}
```

Use `FooCriteria`

```
namespace App\Entity;

use App\Criteria\FooCriteria;

class Bar
{
    /**
     * @var \Doctrine\Common\Collections\Collection
     *
     * @ORM\OneToMany(targetEntity="Foo", mappedBy="bar")
     */
    private $foos;

    public function getFilteredFoos()
    {
        $criteria = FooCriteria::create();
        $criteria = $criteria
            ->where($criteria->expr()->eq('fieldX', 1)) // Check if fieldX is defined in Foo class
        ;

        return $this->foos->matching($criteria);
    }
}
```

Author
------

[](#author)

Toshiyuki Fujita -  -

License
-------

[](#license)

Licensed under the MIT License - see the [LICENSE](LICENSE) file for details

---

OTOBANK Inc.

###  Health Score

53

—

FairBetter than 96% of packages

Maintenance74

Regular maintenance activity

Popularity32

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 68.3% 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 ~363 days

Recently: every ~489 days

Total

8

Last Release

144d ago

PHP version history (3 changes)v0.1.0PHP ~7.1

0.4.0PHP ^7.2

0.6.0PHP ^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/434940?v=4)[Toshiyuki Fujita](/maintainers/kalibora)[@kalibora](https://github.com/kalibora)

![](https://www.gravatar.com/avatar/856c3f42e6c5c44afc62b1234359933ba09ac1cdad05be73afbb8d20328f02d3?d=identicon)[sasezaki-k](/maintainers/sasezaki-k)

---

Top Contributors

[![sasezaki](https://avatars.githubusercontent.com/u/42755?v=4)](https://github.com/sasezaki "sasezaki (28 commits)")[![kalibora](https://avatars.githubusercontent.com/u/434940?v=4)](https://github.com/kalibora "kalibora (10 commits)")[![sasezaki-k](https://avatars.githubusercontent.com/u/36872579?v=4)](https://github.com/sasezaki-k "sasezaki-k (3 commits)")

---

Tags

PHPStandoctrine

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/otobank-phpstan-doctrine-criteria/health.svg)

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

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k300.5M7.5k](/packages/doctrine-orm)[api-platform/doctrine-common

Common files used by api-platform/doctrine-orm and api-platform/doctrine-odm

274.4M48](/packages/api-platform-doctrine-common)[rector/rector-src

Instant Upgrade and Automated Refactoring of any PHP code

136406.3k14](/packages/rector-rector-src)[ssch/typo3-rector

Instant fixes for your TYPO3 PHP code by using Rector.

2603.2M435](/packages/ssch-typo3-rector)[contao/core-bundle

Contao Open Source CMS

1231.6M2.8k](/packages/contao-core-bundle)[laravel-doctrine/orm

An integration library for Laravel and Doctrine ORM

8465.5M96](/packages/laravel-doctrine-orm)

PHPackages © 2026

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