PHPackages                             jdecool/enum-doctrine - 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. jdecool/enum-doctrine

AbandonedArchivedLibrary

jdecool/enum-doctrine
=====================

Doctrine for enum objects

1.1.0(5y ago)047MITPHPPHP ^8.0

Since Dec 8Pushed 4y ago1 watchersCompare

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

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

Doctrine Enum Type
==================

[](#doctrine-enum-type)

[![Build Status](https://github.com/jdecool/enum-doctrine/workflows/CI/badge.svg)](https://github.com/jdecool/enum-doctrine/actions?query=workflow%3ACI)[![Latest Stable Version](https://camo.githubusercontent.com/3515e98a89ba6066acd902d77e626d3fca1a7433fe869538cdb0e9ba3b0cc5a0/68747470733a2f2f706f7365722e707567782e6f72672f6a6465636f6f6c2f656e756d2d646f637472696e652f762f737461626c652e706e67)](https://packagist.org/packages/jdecool/enum-doctrine)

This package provides a base implementation to define doctrine entity column types that are mapped to `JDecool\Enum\Enum` objects (of [`jdecool/enum`](https://github.com/jdecool/enum) package).

This is a port of [`acelaya/doctrine-enum-type`](https://github.com/acelaya/doctrine-enum-type).

Deprecated
----------

[](#deprecated)

⚠️ This project is no longer actively maintained.

Native enum arrived to PHP in version 8.1: If your project is running PHP 8.1+ or your library has it as a minimum requirement you should use it instead of this library.

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

[](#installation)

Install it using [Composer](https://getcomposer.org):

```
composer require jdecool/enum-doctrine
```

Usage
-----

[](#usage)

This package provides a `JDecool\Enum\Doctrine\EnumType` class that extends `Doctrine\DBAL\Types\Type`. You can use it to easily map type names to concrete Enums.

The `EnumType` class will be used as the doctrine type for every property that is an enumeration.

```
use JDecool\Enum\Enum;

class MyEnum extends Enum
{
    public const ENUM_1 = 'value_1';
    protected const ENUM_2 = 'value_2';
    private const ENUM_3 = 'value_3';
}
```

Then, you can map the enum to your entity.

```
class User
{
    // ...

    /**
     * @var MyEnum
     *
     * @ORM\Column(type=MyEnum::class, length=10)
     */
    protected $action;

    // ...
}
```

The column type of the property is the FQCN of the `MyEnum` enum. To get this working, you have to register the concrete column types, using the `JDecool\Enum\Doctrine\EnumType::registerEnumType` static method.

```
// in bootstrapping code
use JDecool\Enum\Doctrine\EnumType;

EnumType::registerEnumType(MyEnum::class);

// Don't forget to register the enums for schema operations
$platform = $em->getConnection()->getDatabasePlatform();
$platform->registerDoctrineTypeMapping('VARCHAR', MyEnum::class);
```

Alternatively you can use the `JDecool\Enum\Doctrine\EnumType::registerEnumTypes`, which expects an array of enums to register.

```
// ...

use JDecool\Enum\Doctrine\EnumType;

EnumType::registerEnumTypes([
    MyEnum::class,
    'php_enum_type' => MyEnum::class,
]);
```

If you use Doctrine with Symfony:

```
# config/packages/doctrine.yaml
doctrine:
    dbal:
        types:
            uuid: JDecool\Enum\Doctrine\EnumType
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

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

Total

3

Last Release

1985d ago

### Community

Maintainers

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

---

Top Contributors

[![jdecool](https://avatars.githubusercontent.com/u/433926?v=4)](https://github.com/jdecool "jdecool (8 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/jdecool-enum-doctrine/health.svg)

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

###  Alternatives

[sonata-project/entity-audit-bundle

Audit for Doctrine Entities

644989.8k1](/packages/sonata-project-entity-audit-bundle)[overtrue/laravel-versionable

Make Laravel model versionable.

585308.0k5](/packages/overtrue-laravel-versionable)[elgg/elgg

Elgg is an award-winning social networking engine, delivering the building blocks that enable businesses, schools, universities and associations to create their own fully-featured social networks and applications.

1.7k15.7k5](/packages/elgg-elgg)[neos/flow

Flow Application Framework

862.0M451](/packages/neos-flow)[neos/flow-development-collection

Flow packages in a joined repository for pull requests.

144179.3k3](/packages/neos-flow-development-collection)[rias/statamic-redirect

28298.4k](/packages/rias-statamic-redirect)

PHPackages © 2026

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