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

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

acelaya/doctrine-enum-type
==========================

A custom Doctrine type that maps column values to enum objects using myclabs/php-enum

v2.5.0(5y ago)1312.1M↓10.6%14[1 issues](https://github.com/acelaya/doctrine-enum-type/issues)4MITPHPPHP ^7.4 || ^8.0

Since Jul 26Pushed 3y ago3 watchersCompare

[ Source](https://github.com/acelaya/doctrine-enum-type)[ Packagist](https://packagist.org/packages/acelaya/doctrine-enum-type)[ Fund](https://acel.me/donate)[ GitHub Sponsors](https://github.com/acelaya)[ RSS](/packages/acelaya-doctrine-enum-type/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (16)Used By (4)

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

[](#doctrine-enum-type)

[![Build Status](https://camo.githubusercontent.com/5f110e506827b22e671c28211dcbc7c5a9bdca5571fba7642524d3c3beefaa51/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6163656c6179612f646f637472696e652d656e756d2d747970652f436f6e74696e756f7573253230696e746567726174696f6e2f6d61696e3f6c6f676f3d676974687562267374796c653d666c61742d737175617265)](https://github.com/acelaya/doctrine-enum-type/actions?query=workflow%3A%22Continuous+integration%22)[![Code Coverage](https://camo.githubusercontent.com/ccd0e0cf036bf77ebd0835ac32d866cb52296efff4ed2c79ff6b6212639027ac/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f67682f6163656c6179612f646f637472696e652d656e756d2d747970652f6d61696e3f7374796c653d666c61742d737175617265)](https://app.codecov.io/gh/acelaya/doctrine-enum-type)[![Latest Stable Version](https://camo.githubusercontent.com/3c281ba14d2e78bc698e1a468e7bcae1cca60c57436752a058c31a77989da176/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6163656c6179612f646f637472696e652d656e756d2d747970652e7376673f7374796c653d666c61742d737175617265)](https://github.com/acelaya/doctrine-enum-type/releases/latest)[![Total Downloads](https://camo.githubusercontent.com/8c5434c7f19ddb9b15c269f18807d8a64f10c58aa53192f8c1081b4d71f668e6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6163656c6179612f646f637472696e652d656e756d2d747970652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/acelaya/doctrine-enum-type)[![License](https://camo.githubusercontent.com/eb1943ad3b727c33ff104c211aa6889e3d3f8d68387010884acdad736e62f77c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6163656c6179612f646f637472696e652d656e756d2d747970652e7376673f7374796c653d666c61742d737175617265)](https://github.com/acelaya/doctrine-enum-type/blob/main/LICENSE)[![Paypal Donate](https://camo.githubusercontent.com/d747bb27455dd0b8a72005e7c31ded7c8a6e28231f31578024833a9267d0f0c4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f6e6174652d70617970616c2d626c75652e7376673f7374796c653d666c61742d737175617265266c6f676f3d70617970616c26636f6c6f72413d636363636363)](https://acel.me/donate)

⚠️ This package is no longer relevant since PHP now has native enums and doctrine officially supports them
----------------------------------------------------------------------------------------------------------

[](#️-this-package-is-no-longer-relevant-since-php-now-has-native-enums-and-doctrine-officially-supports-them)

---

This package provides a base implementation to define doctrine entity column types that are mapped to `MyCLabs\Enum\Enum` objects. That class is defined in the fantastic [myclabs/php-enum](https://github.com/myclabs/php-enum) package.

### Installation

[](#installation)

The recommended installation method is by using [composer](https://getcomposer.org/)

```
composer require acelaya/doctrine-enum-type

```

### Usage

[](#usage)

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

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

Let's imagine we have this two enums.

```
