PHPackages                             extalion/php-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. extalion/php-enum

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

extalion/php-enum
=================

Gives the ability to emulate and create enumeration objects in PHP.

0.1.1(6y ago)16251MITPHPPHP ^7.2

Since Dec 18Pushed 6y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (3)Used By (1)

php-enum
========

[](#php-enum)

Gives the ability to emulate and create enumeration objects in PHP.

Install
-------

[](#install)

```
composer install extalion/php-enum
```

How to use
----------

[](#how-to-use)

Enum definition:

```
/**
 * @method static RequestMethod get()
 * @method static RequestMethod post()
 */
final class RequestMethod extends \Enum
{
    const VALUES = [
        'get' => 1,
        'post' => 2
    ];
}
```

Usage:

```
function request(string $url, RequestMethod $method, array $data = [])
{
    // ...

    if ($method === RequestMethod::post()) {
        \curl_setopt($ch, \CURLOPT_POST, 1);
        \curl_setopt($ch, \CURLOPT_POSTFIELDS, $data);
    }

    // ...
}
```

Tests
-----

[](#tests)

```
php -d zend.assertions=1 test.php
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity43

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

Total

2

Last Release

2211d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9dbae32495a7944e5369005d48c1c687c1ed9a965c6d24cfe65bff54ad3ce6f0?d=identicon)[d0niek](/maintainers/d0niek)

---

Top Contributors

[![d0niek](https://avatars.githubusercontent.com/u/9316891?v=4)](https://github.com/d0niek "d0niek (15 commits)")

---

Tags

enumphptypephptypeenum

### Embed Badge

![Health badge](/badges/extalion-php-enum/health.svg)

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

###  Alternatives

[garoevans/php-enum

Convenient way to always have an Enum object available and utilise Spl Types if available.

19158.8k5](/packages/garoevans-php-enum)[zakirullin/mess

Convenient array-related routine &amp; better type casting

21228.9k2](/packages/zakirullin-mess)[strictus/strictus

Strict Typing for local variables in PHP

1606.9k](/packages/strictus-strictus)[iteks/laravel-enum

A comprehensive Laravel package providing enhanced enum functionalities, including attribute handling, select array conversions, and fluent facade interactions for robust enum management in Laravel applications.

2516.7k](/packages/iteks-laravel-enum)[ducks-project/spl-types

Polyfill Module for SplType PHP extension. This extension aims at helping people making PHP a stronger typed language and can be a good alternative to scalar type hinting. It provides different typehandling classes as such as integer, float, bool, enum and string

1032.4k](/packages/ducks-project-spl-types)

PHPackages © 2026

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