PHPackages                             phariscope/doctrineenumtype - 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. phariscope/doctrineenumtype

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

phariscope/doctrineenumtype
===========================

A way to create quickly and well tested doctrine type for your php enums

v1.0.0(1y ago)01.3kMITPHPPHP &gt;=8.1

Since Nov 26Pushed 1y agoCompare

[ Source](https://github.com/phariscope/DoctrineEnumType)[ Packagist](https://packagist.org/packages/phariscope/doctrineenumtype)[ Docs](https://github.com/phariscope/DoctrineEnumType)[ RSS](/packages/phariscope-doctrineenumtype/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (8)Versions (8)Used By (0)

Phariscope DoctrineEnumType
===========================

[](#phariscope-doctrineenumtype)

To persist php enum fields with Doctrine, you have to create doctrine an enum type class for each enum.

To keep it easy and reduce the amount of tests use EnumType.

Installation
============

[](#installation)

```
composer require phariscope/doctrineenumtype
```

Usage
=====

[](#usage)

Create your enum object as usual. For example:

```
enum Example: string
{
    case EXAMPLE = 'EXAMPLE';
    case FAKE = 'FAKE';
    case REAL = 'REAL';
}
```

Create your doctrine enum type test. For example:

```
class ExampleTypeTest extends TestCase
{
    public function testGetName(): void
    {
        $this->assertEquals('enum_example', (new ExampleType())->getName());
    }
```

Your production code source will be very short and look like to this:

```
use Phariscope\DoctrineEnumType\EnumType;

class ExampleType extends EnumType
{
    protected string $name = "enum_example";
    protected string $className = EnumExample::class;
}
```

Now you can use this new 'ExampleType' with Doctrine ORM.

```

```

of course don't forget to declare this new type to doctrine (`Type::addType("enum_example", ExampleType::class)` somewhere in your application).

To Contribute to phariscope/DoctrineEnumType
============================================

[](#to-contribute-to-phariscopedoctrineenumtype)

Requirements
------------

[](#requirements)

- docker
- git

Install
-------

[](#install)

```
git clone git@github.com:phariscope/DoctrineEnumType.git
cd DoctrineEnumType
./install
```

Installation will load php docker image and composer install, so all commands contained in the 'bin' folder will be easily accessbile.

Example:

```
bin/php -v
```

Unit test
---------

[](#unit-test)

```
bin/phpunit
```

Using Test-Driven Development (TDD) principles (thanks to Kent Beck and others), following good practices (thanks to Uncle Bob and others).

Quality
-------

[](#quality)

- phpcs PSR12
- phpstan level 9
- coverage 100%
- infection MSI &gt;99%

Quick check with:

```
./codecheck
```

Check coverage with:

```
bin/phpunit --coverage-html var
```

and view 'var/index.html' with your browser

Check infection with:

```
bin/infection
```

and view 'var/infection.html' with your browser

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance40

Moderate activity, may be stable

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 55.6% 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 ~83 days

Total

5

Last Release

572d ago

Major Versions

v0.0.4 → v1.0.02024-10-23

### Community

Maintainers

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

---

Top Contributors

[![frederic100](https://avatars.githubusercontent.com/u/50176793?v=4)](https://github.com/frederic100 "frederic100 (5 commits)")[![brudert](https://avatars.githubusercontent.com/u/74777353?v=4)](https://github.com/brudert "brudert (2 commits)")[![lrix](https://avatars.githubusercontent.com/u/55502105?v=4)](https://github.com/lrix "lrix (2 commits)")

---

Tags

typeenumdoctrine

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/phariscope-doctrineenumtype/health.svg)

```
[![Health](https://phpackages.com/badges/phariscope-doctrineenumtype/health.svg)](https://phpackages.com/packages/phariscope-doctrineenumtype)
```

###  Alternatives

[fresh/doctrine-enum-bundle

Provides support of ENUM type for Doctrine2 in Symfony applications.

4636.8M12](/packages/fresh-doctrine-enum-bundle)[larapack/doctrine-support

Better Doctrine Support with Laravel (Support for `enum`)

1752.3M55](/packages/larapack-doctrine-support)[vasek-purchart/doctrine-date-time-immutable-types

Doctrine DateTimeImmutable types

42228.3k](/packages/vasek-purchart-doctrine-date-time-immutable-types)[vasek-purchart/doctrine-date-time-immutable-types-bundle

Bundle integration of Doctrine DateTimeImmutable types for Symfony

1085.6k](/packages/vasek-purchart-doctrine-date-time-immutable-types-bundle)

PHPackages © 2026

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