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

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

sunnyphp/enum
=============

Simple AbstractEnum class

v1.0.1(4y ago)115WTFPLPHPPHP ^7.4 || ^8

Since Sep 5Pushed 4y ago1 watchersCompare

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

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

Simple AbstractEnum class
-------------------------

[](#simple-abstractenum-class)

### Installation

[](#installation)

```
composer require sunnyphp/enum
```

### Usage

[](#usage)

```
use SunnyPHP\Enum\AbstractEnum;

class MyEnum extends AbstractEnum
{
    public const HELLO = 1;
    public const WORLD = 2;
}
```

### Methods

[](#methods)

Method nameDescriptionExampleReturns`get`Returns constant value if exists or default value (42) if not exists`MyEnum::get('HELLO', 42)``1``getValues`Returns all constant values`MyEnum::getValues()``[1, 2, ]``getKeys`Returns all keys (constant names)`MyEnum::getKeys()``['HELLO', 'WORLD', ]``getAll`Returns all constants, key-value pairs`MyEnum::getAll()``['HELLO' => 1, 'WORLD' => 2, ]``hasValue`Returns True if constant value is exists`MyEnum::hasValue(1)``true``hasKey`Returns True if constant is exists`MyEnum::hasKey('HELLO')``true``hasAnyKey`Returns True if one or more constants is exists`MyEnum::hasAnyKey('FOO', 'HELLO', 'BAR')``true`

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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 ~378 days

Total

2

Last Release

1703d ago

PHP version history (2 changes)v1.0PHP ^7.4

v1.0.1PHP ^7.4 || ^8

### Community

Maintainers

![](https://www.gravatar.com/avatar/2d3c06ba089f07a9a059a64949f5e608ae3aa4e0eaec67424f4d052c5c27ad44?d=identicon)[sunnyphp](/maintainers/sunnyphp)

---

Top Contributors

[![sunnyphp](https://avatars.githubusercontent.com/u/3903438?v=4)](https://github.com/sunnyphp "sunnyphp (2 commits)")[![web-flow](https://avatars.githubusercontent.com/u/19864447?v=4)](https://github.com/web-flow "web-flow (1 commits)")

---

Tags

enumenumerationSimpleconstantsabstractenumsconstantenumerationssimplicityabstract class

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[marc-mabe/php-enum

Simple and fast implementation of enumerations with native PHP

49644.8M97](/packages/marc-mabe-php-enum)[rexlabs/enum

Enumeration (enum) implementation for PHP

48482.2k2](/packages/rexlabs-enum)[cerbero/enum

Zero-dependencies package to supercharge enum functionalities.

359207.5k2](/packages/cerbero-enum)[cerbero/laravel-enum

Laravel package to supercharge enum functionalities.

18989.6k](/packages/cerbero-laravel-enum)[emreyarligan/enum-concern

A PHP package for effortless Enumeration handling with Laravel Collections 📦 ✨

21156.3k1](/packages/emreyarligan-enum-concern)[thunderer/platenum

PHP enum library

36145.7k](/packages/thunderer-platenum)

PHPackages © 2026

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