PHPackages                             divengine/enum - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. divengine/enum

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

divengine/enum
==============

Div PHP Enum Solution

1.0.2(2y ago)4141GPL-3.0-or-laterPHPPHP &gt;=5.0.0

Since Jan 13Pushed 4mo agoCompare

[ Source](https://github.com/divengine/enum)[ Packagist](https://packagist.org/packages/divengine/enum)[ Docs](https://divengine.com)[ RSS](/packages/divengine-enum/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Div PHP Enum
============

[](#div-php-enum)

Div PHP Enum is a small class-based enum pattern for PHP. It predates PHP 8.1 native enums and is not a replacement for them. Use it when you need class hierarchies, polymorphic behavior, or compatibility with older PHP versions.

Why this library
----------------

[](#why-this-library)

- Build enum taxonomies with inheritance.
- Use type hints to constrain families of values.
- Add behavior directly on each enum class.
- Keep a tiny, dependency-free implementation.

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

[](#requirements)

- PHP 5.0 or higher

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

[](#installation)

```
composer require divengine/enum
```

Quick start
-----------

[](#quick-start)

```
