PHPackages                             nighten/doctrine-check - 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. nighten/doctrine-check

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

nighten/doctrine-check
======================

Provides check for doctrine type mapping

0.7.0(1y ago)1614↓66.7%MITPHPPHP &gt;=8.1

Since Jun 7Pushed 1y ago1 watchersCompare

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

READMEChangelog (4)Dependencies (6)Versions (8)Used By (0)

Doctrine check
==============

[](#doctrine-check)

Tool for check doctrine entity field mapping with php types.

Install
-------

[](#install)

```
composer require nighten/doctrine-check --dev
```

Running
-------

[](#running)

Create a `doctrine-check-config.php` in your root directory and modify:

Need to add doctrine object manager to config. Example for Symfony project:

```
use App\Kernel;
use Nighten\DoctrineCheck\Config\DoctrineCheckConfig;
use Symfony\Component\Dotenv\Dotenv;

require __DIR__ . '/vendor/autoload.php';

return function (DoctrineCheckConfig $config): void {
    (new Dotenv())->bootEnv(__DIR__ . '/.env');
    $kernel = new Kernel($_SERVER['APP_ENV'], (bool)$_SERVER['APP_DEBUG']);
    $kernel->boot();

    $config->addObjectManager($kernel->getContainer()->get('doctrine')->getManager());
};
```

Then run check:

```
vendor/bin/doctrine-check types
```

The list of checks:
-------------------

[](#the-list-of-checks)

#### Simple types such as int, string, bool, datetime and so on. Check match type and nullable

[](#simple-types-such-as-int-string-bool-datetime-and-so-on-check-match-type-and-nullable)

Example:

```
#[ORM\Column(type: 'string', nullable: true)]
private ?string $code;

#[ORM\Column(type: 'integer', nullable: false, enumType: Type::class)]
private Type $type;

#[ORM\Column(type: 'boolean', nullable: false)]
private bool $deleted = false;

#[ORM\Column(type: 'datetime_immutable', nullable: true)]
private ?DateTimeImmutable $updatedAt = null;
```

#### Association mapping ManyToOne:

[](#association-mapping-manytoone)

Example:

```
#[
    ORM\ManyToOne(targetEntity: User::class),
    ORM\JoinColumn(nullable: false),
]
private User $user;
```

#### Embedded mapping:

[](#embedded-mapping)

Types and nulls in the embeddable class are checked.

Types and null are checked in the main class

Example:

```
#[Embeddable]
class Address
{
    #[ORM\Column(type: 'string', nullable: true)]
    private ?string $code;
}

class User
{
    #[Embedded(class: Address::class)]
    private Address $address;
    ...
}
```

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

[](#configuration)

### Add additional type mappings:

[](#add-additional-type-mappings)

```
use Symfony\Component\Uid\UuidV1;
use Symfony\Component\Uid\UuidV4;
use Symfony\Component\Uid\UuidV7;

//...

return function (DoctrineCheckConfig $config): void {
    //...
    $config->addTypeMapping('uuid', UuidV1::class);
    $config->addTypeMapping('uuid', UuidV4::class);
    $config->addTypeMapping('uuid', UuidV7::class);
};
```

### Add specific entity classes:

[](#add-specific-entity-classes)

The checker will check only the specified classes

```
use App\Entity\EntityClass;
use Nighten\DoctrineCheck\Type;

//...

return function (DoctrineCheckConfig $config): void {
    //...
    $config->addEntityClass(EntityClass::class);
};
```

### Ignore some entity classes:

[](#ignore-some-entity-classes)

The checker will check all classes except those specified

```
use App\Entity\EntityClass;
use Nighten\DoctrineCheck\Type;

//...

return function (DoctrineCheckConfig $config): void {
    //...
    $config->addExcludedEntityClasses(EntityClass::class);
};
```

### Add error ignores:

[](#add-error-ignores)

The checker will skip the specified errors

```
use App\Entity\EntityClass;
use Nighten\DoctrineCheck\Type;

//...

return function (DoctrineCheckConfig $config): void {
    //...
    $config->addIgnore(EntityClass::class, 'name', ErrorType::TYPE_WRONG_NULLABLE);
};
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance41

Moderate activity, may be stable

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

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 ~37 days

Recently: every ~53 days

Total

7

Last Release

486d ago

PHP version history (2 changes)0.1.0PHP &gt;=8.0

0.4.0PHP &gt;=8.1

### Community

Maintainers

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

---

Top Contributors

[![nighten](https://avatars.githubusercontent.com/u/7446731?v=4)](https://github.com/nighten "nighten (29 commits)")

---

Tags

devstatic analysisdebuginspectiondoctrine

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/nighten-doctrine-check/health.svg)

```
[![Health](https://phpackages.com/badges/nighten-doctrine-check/health.svg)](https://phpackages.com/packages/nighten-doctrine-check)
```

###  Alternatives

[scienta/doctrine-json-functions

A set of extensions to Doctrine that add support for json query functions.

58723.9M36](/packages/scienta-doctrine-json-functions)[laravel-doctrine/orm

An integration library for Laravel and Doctrine ORM

8425.3M87](/packages/laravel-doctrine-orm)[sonata-project/doctrine-orm-admin-bundle

Integrate Doctrine ORM into the SonataAdminBundle

46117.7M155](/packages/sonata-project-doctrine-orm-admin-bundle)[weirdan/doctrine-psalm-plugin

Stubs to let Psalm understand Doctrine better

876.9M50](/packages/weirdan-doctrine-psalm-plugin)[doctrine/coding-standard

The Doctrine Coding Standard is a set of PHPCS rules applied to all Doctrine projects.

31914.1M739](/packages/doctrine-coding-standard)[doctrine/doctrine-orm-module

Laminas Module that provides Doctrine ORM functionality

4407.3M293](/packages/doctrine-doctrine-orm-module)

PHPackages © 2026

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