PHPackages                             neutronstars/doctrine-enum-php-type - 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. neutronstars/doctrine-enum-php-type

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

neutronstars/doctrine-enum-php-type
===================================

Added a doctrine type for the php enumeration system designed to be as close as possible to PHP 8.1 for earlier versions.

1.2.0(4y ago)113Apache-2.0PHPPHP ^7.1 | ^8.0

Since Jul 8Pushed 4y ago1 watchersCompare

[ Source](https://github.com/Neutron-Pro/doctrine-enum-php-type)[ Packagist](https://packagist.org/packages/neutronstars/doctrine-enum-php-type)[ RSS](/packages/neutronstars-doctrine-enum-php-type/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (6)Used By (0)

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

[](#doctrine-enum-php-type)

---

Read the enum php doc:
----------------------

[](#read-the-enum-php-doc)

>

---

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

[](#installation)

`composer require neutronstars/doctrine-enum-php-type`

---

Doctrine Configuration
----------------------

[](#doctrine-configuration)

If you use it, you must create a Type class for your enum:

```
namespace App\Types;

class MyEnumType extends \NeutronStars\Enum\Types\EnumType {
  public const MY_ENUM = 'my_enum';

  public function getName(): string
  {
    return self::MY_ENUM;
  }

  public function convertToPHPValue($value,\Doctrine\DBAL\Platforms\AbstractPlatform $platform): MyEnum
  {
    return MyEnum::from($value);
  }
}
```

You must add this to the `doctrine.yaml` configuration file:

```
doctrine:
  dbal:
    types:
      my_enum:
        class: App\Types\MyEnumType
```

On the annotation that contains the field of your entity, you must put the type:

```
/**
 * @ORM\Column(type="my_enum")
 * @var MyEnum|null
 */
private ?MyEnum $myEnum;
```

you must comment out the column that contains the enum during your sql migration:

```
$this->addSql('COMMENT ON COLUMN "your_table"."your_column" IS \'(DC2Type:my_enum)\';');
```

---

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

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

Total

5

Last Release

1765d ago

### Community

Maintainers

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

---

Top Contributors

[![Neutron-Pro](https://avatars.githubusercontent.com/u/72473350?v=4)](https://github.com/Neutron-Pro "Neutron-Pro (1 commits)")

---

Tags

doctrinedoctrine-ormphpphp-enumphp7php71php72php73php74php8symfony

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/neutronstars-doctrine-enum-php-type/health.svg)

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

###  Alternatives

[scienta/doctrine-json-functions

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

58523.9M35](/packages/scienta-doctrine-json-functions)[martin-georgiev/postgresql-for-doctrine

Extends Doctrine with native PostgreSQL support for arrays, JSONB, ranges, PostGIS geometries, text search, ltree, uuid, and 100+ PostgreSQL-specific functions.

4485.3M4](/packages/martin-georgiev-postgresql-for-doctrine)[damienharper/auditor-bundle

Integrate auditor library in your Symfony projects.

4542.8M](/packages/damienharper-auditor-bundle)[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)[worksome/foggy

Foggy is a tool for making database dumps with some data removed/changed.

26571.7k1](/packages/worksome-foggy)

PHPackages © 2026

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