PHPackages                             cyril-verloop/doctrine-properties - 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. cyril-verloop/doctrine-properties

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

cyril-verloop/doctrine-properties
=================================

Some default doctrine entity/fields requiring PHP &gt;=8.5 and Doctrine ORM 3.6.

02↓90%PHPCI passing

Since Apr 11Pushed 2w agoCompare

[ Source](https://github.com/cyrilverloop/doctrine-properties)[ Packagist](https://packagist.org/packages/cyril-verloop/doctrine-properties)[ RSS](/packages/cyril-verloop-doctrine-properties/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

doctrine-properties
===================

[](#doctrine-properties)

Some default doctrine entity/fields requiring PHP &gt;=8.5 and Doctrine ORM &gt;=3.6.

**This project is not yet stable.**

This includes :

- `AbstractIntId` : a mapped superclass with an `$id` as an integer identifier/primary key;
- `IntIdInterface` : an interface for integer id;
- `BoolExample` : a class with `$active`, `$available` boolean properties;
- `IntExample` : a class with `$priority` integer property;
- `NullableStringExample` : a class with `$description`, `$email`, `$firstname`, `$lastname`, `$name`, `$slug` and `$surname` nullable string properties;
- `StringExample` : a class that adds `$description`, `$email`, `$firstname`, `$lastname`, `$name`, `$slug` and `$surname` string properties;

[![License](https://camo.githubusercontent.com/dc198fd090880e940a2b57e6052a16fad5fe30e6a5ab5b4d428146b5f5bae99d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f637972696c7665726c6f6f702f646f637472696e652d70726f70657274696573)](https://github.com/cyrilverloop/doctrine-properties/blob/trunk/LICENSE)[![Minimum PHP version](https://camo.githubusercontent.com/55f23332bb1eda08f59bbcb5100f14478829657719232e13156b722056ca28c0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e352d2532333737374242343f6c6f676f3d706870267374796c653d666c6174)](https://www.php.net/)

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

[](#installation)

### As a Composer depedency

[](#as-a-composer-depedency)

In your project directory run

```
user@host project$ composer require "cyril-verloop/doctrine-properties"
```

### For development purposes

[](#for-development-purposes)

```
user@host ~$ cd [PATH_WHERE_TO_PUT_THE_PROJECT] # E.g. ~/projects/
user@host projects$ git clone https://github.com/cyrilverloop/doctrine-properties.git
user@host projects$ cd doctrine-properties
user@host doctrine-properties$ composer install -o
user@host doctrine-properties$ phive install --trust-gpg-keys 4AA394086372C20A,99BF4D9A33D65E1E,6DA3ACC4991FFAE5,C5095986493B4AA0
```

Mappings
--------

[](#mappings)

There are attributes and XML mappings.

### Symfony

[](#symfony)

To use with Symfony, copy the attribute or XML configuration below and add it to the `config/packages/doctrine.yaml` file of your project.

```
doctrine:
    orm:
        mappings:
            # For attribute :
            CVDP:
                alias: CVDP
                dir: '%kernel.project_dir%/vendor/cyril-verloop/doctrine-properties/src'
                prefix: 'CyrilVerloop\DoctrineProperties'
                type: attribute

            # For XML :
            CVDP:
                alias: CVDP
                dir: '%kernel.project_dir%/vendor/cyril-verloop/doctrine-properties/config/doctrine'
                prefix: CyrilVerloop\DoctrineProperties
                type: xml
```

You can also look at the `resources/config/packages/doctrine.yaml` file.

### XML

[](#xml)

#### Entity

[](#entity)

The XML file is located in the `config/doctrine/` directory. You just have to copy or reference it depending on your needs.

#### Properties

[](#properties)

You need to copy the require configuration in your XML file.

For example :

```

        true

        0

```

You can also look at the `resources/mappings/Example.orm.xml` file.

Usage
-----

[](#usage)

### AbstractIntId / IntIdInterface

[](#abstractintid--intidinterface)

If your entities need an integer as an identifier/primary key :

- they can extend the mapped super class `CyrilVerloop\DoctrineProperties\AbstractIntId`

```
use CyrilVerloop\DoctrineProperties\AbstractIntId;

class Product extends AbstractIntId
{
    public function __construct()
    {
        // You can call the parent constructor
        // to initiate the id to null
        // or initiate it yourself :
        parent::__construct();
    }
}
```

- implement the `CyrilVerloop\DoctrineProperties\IntIdInterface` interface

```
use CyrilVerloop\DoctrineProperties\IntIdInterface;

class Product implements IntIdInterface
{
    // Your code here.
}
```

### Properties

[](#properties-1)

Example properties are in `*Example.php` files.

### Unit tests

[](#unit-tests)

Example unit tests for PHPUnit are in `./tests/`.

Continuous integration
----------------------

[](#continuous-integration)

### Tests

[](#tests)

To run the tests :

```
user@host doctrine-properties$ ./tools/phpunit -c ./ci/phpunit.xml
```

The generated outputs will be in `./ci/phpunit/`. Look at `./ci/phpunit/html/index.html` for code coverage and `./ci/phpunit/testdox.html` for a verbose list of passing / failing tests.

To run mutation testing, you must run PHPUnit first, then :

```
user@host doctrine-properties$ ./tools/infection -c./ci/infection.json
```

The generated outputs will be in `./ci/infection/`.

### Static analysis

[](#static-analysis)

To do a static analysis :

```
user@host doctrine-properties$ ./tools/psalm -c ./ci/psalm.xml [--report=./psalm/psalm.txt --output-format=text]
```

Use "--report=./psalm/psalm.txt --output-format=text" if you want the output in a file instead of on screen.

### PHPDoc

[](#phpdoc)

To generate the PHPDoc :

```
user@host doctrine-properties$ ./tools/phpdocumentor --config ./ci/phpdoc.xml
```

The generated HTML documentation will be in `./ci/phpdoc/`.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance63

Regular maintenance activity

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 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/322b031f8ce9fdaf307dc75cc45a33dd2d7ea8e5c75c4e5fc7e5507ccab294f7?d=identicon)[cyrilverloop](/maintainers/cyrilverloop)

---

Top Contributors

[![cyrilverloop](https://avatars.githubusercontent.com/u/37014314?v=4)](https://github.com/cyrilverloop "cyrilverloop (14 commits)")

---

Tags

doctrinephp

### Embed Badge

![Health badge](/badges/cyril-verloop-doctrine-properties/health.svg)

```
[![Health](https://phpackages.com/badges/cyril-verloop-doctrine-properties/health.svg)](https://phpackages.com/packages/cyril-verloop-doctrine-properties)
```

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k116.5M113](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)

PHPackages © 2026

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