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

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

evaisse/php-simple-enum
=======================

A very stupid, basic, enum control struct for php

v1.0.0(6y ago)04MITPHPPHP &gt;=5.6.0CI failing

Since May 27Pushed 6y ago1 watchersCompare

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

READMEChangelogDependencies (2)Versions (2)Used By (0)

php-simple-enum
===============

[](#php-simple-enum)

[![codecov](https://camo.githubusercontent.com/897bb24150572e5f0a02a030442c6c88fb30d18795c272844297c0da48fe66f6/68747470733a2f2f636f6465636f762e696f2f67682f657661697373652f7068702d73696d706c652d656e756d2f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/evaisse/php-simple-enum)[![Build Status](https://camo.githubusercontent.com/d69996c0c194762146bf5fd3faca3188e6cc617158ad3276dd4f565190f4842d/68747470733a2f2f7472617669732d63692e6f72672f657661697373652f7068702d73696d706c652d656e756d2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/evaisse/php-simple-enum)

A Simple ENUM utils, to ensure inputs are compliant with your some basic data structs.

```
composer require evaisse/php-simple-enum
```

Allow to fetch a static list of values from givens constants :

```
use evaisse\PhpSimpleEnum\PhpEnum;

$enumInt = new PhpEnum([
    'FOO' => 1,
    'BAR' => 2,
]);

$enum = PhpEnum::fromConstants('\Symfony\Component\HttpFoundation\Request::METHOD_*');

$enum->getAllowedValues();
/*
[
    'GET', 'POST', ...
]
 */

/*
 * Fetch enum name for a given value
 */
assert($enum->getKeyForValue(\Symfony\Component\HttpFoundation\Request::METHOD_GET) === 'METHOD_GET');

/*
 * test value
 */
$enum->isAllowed('GET'); // true

/*
 * fetch and assign, or throw invalid argument exception
 */
$param = $enum->validate($_GET['askedValue']);

/*
 * Fetch the whole dictonary
 */
$enum->getHash(); /*
   [
        'METHOD_GET' => 'GET',
        ...
    ]
*/
```

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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

Unknown

Total

1

Last Release

2228d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/28737?v=4)[Emmanuel Vaïsse](/maintainers/evaisse)[@evaisse](https://github.com/evaisse)

---

Top Contributors

[![evaisse](https://avatars.githubusercontent.com/u/28737?v=4)](https://github.com/evaisse "evaisse (21 commits)")

### Embed Badge

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

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

###  Alternatives

[pestphp/pest

The elegant PHP Testing Framework.

11.6k72.2M20.5k](/packages/pestphp-pest)[drupal/core-dev

require-dev dependencies from drupal/drupal; use in addition to drupal/core-recommended to run tests from drupal/core.

2022.6M343](/packages/drupal-core-dev)[ec-europa/toolkit

Toolkit packaged for Drupal projects based on Robo.

40252.8k34](/packages/ec-europa-toolkit)

PHPackages © 2026

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