PHPackages                             yungts97/enum-helpers - 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. yungts97/enum-helpers

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

yungts97/enum-helpers
=====================

This is a package that provided some helper functions for PHP Enumeration.

v1.0.0(3y ago)0970↓73.3%MITPHPPHP ^8.1

Since Dec 3Pushed 3y ago1 watchersCompare

[ Source](https://github.com/yungts97/enum-helpers)[ Packagist](https://packagist.org/packages/yungts97/enum-helpers)[ RSS](/packages/yungts97-enum-helpers/feed)WikiDiscussions main Synced yesterday

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

PHP Enum Helpers
================

[](#php-enum-helpers)

 [ ![](https://camo.githubusercontent.com/7b13b9d7ede7f5a8104937f3c4a542c09a20aad77292109c4ca0fe175d32cc66/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f79756e67747339372f656e756d2d68656c706572733f636f6c6f723d323442444343) ](https://packagist.org/packages/yungts97/enum-helpers) [ ![](https://camo.githubusercontent.com/070c9aac3454ebb0db6a87b5d7b1f17fb6ead556cb4d8825db6feb6e3804ad1a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f79756e67747339372f656e756d2d68656c70657273) ](https://github.com/yungts97/enum-helpers/blob/main/LICENSE.md) [ ![](https://camo.githubusercontent.com/63ed550e03acfc7ba3b9e2589083c3799c633f11b90c54478406cb4bcc022e6d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f79756e67747339372f656e756d2d68656c706572733f636f6c6f723d666636396234) ](https://packagist.org/packages/yungts97/enum-helpers) [ ![](https://github.com/yungts97/enum-helpers/workflows/CI/badge.svg) ](https://github.com/yungts97/enum-helpers/actions)

`yungts97/enum-helpers` is a PHP package that extended functionality of the PHP Enumeration.

📦 Environment Requirements
--------------------------

[](#-environment-requirements)

`PHP`: ^8.1

🚀 Installation
--------------

[](#-installation)

You can install the package via composer:

```
composer require yungts97/enum-helpers
```

✨ How to use?
-------------

[](#-how-to-use)

This package is very simple and easy to use. To extend the features of enum. You can add the trait in your enum.

```
use Yungts97\EnumHelpers\Traits\Invokable;
use Yungts97\EnumHelpers\Traits\Contains;
use Yungts97\EnumHelpers\Traits\Random;

enum Status: string
{
    use Invokable, Contains, Random; // add it here

    case Draft = 'draft';
    case Submitted = 'submitted';
    case Pending = 'pending';
    case Approved = 'approved';
    case Rejected = 'rejected';
}
```

### 1. Invokable

[](#1-invokable)

This trait allows Enum to be invokable.

```
Status::Pending() // "pending"
```

### 2. Contains

[](#2-contains)

This trait allows checking whether the value exists in Enum. Agrument accepted `UnitEnum`, `BackedEnum`, `String` and `Int`.

```
Status::contains('pending') // true
Status::contains(Status::Draft) // true
Status::contains(Status::Refund) // false
```

### 3. Random

[](#3-random)

This trait allows Enum to return random value(s).

```
Status::random() // Status::Draft
Status::random(1) // Status::Draft
Status::random(2) // [Status::Draft, Status::Approved]
```

📃 License
---------

[](#-license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

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

1308d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/88c0b9b1b06c681d4a646bdd38ae62d3cc3ac8294a910d49e5b202b7b390d45b?d=identicon)[yungts97](/maintainers/yungts97)

---

Top Contributors

[![yungts97](https://avatars.githubusercontent.com/u/48639619?v=4)](https://github.com/yungts97 "yungts97 (5 commits)")

---

Tags

enumenumerationhelper-functionsphpphp-libraryphp-package

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/yungts97-enum-helpers/health.svg)

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

###  Alternatives

[weboftalent/mappable

Fork of Uncle Cheese's original Mappable module. Inline JavaScript is minimal, and templated such that other mapping systems can be added later. A map editing interface is also included, addable by a one line configuration call.

101.5k4](/packages/weboftalent-mappable)

PHPackages © 2026

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