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

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

bbrothers/enum
==============

A simple PHP Enum implementation

v1.0.0(9y ago)1162MITPHPPHP ~7.0

Since Apr 24Pushed 9y ago1 watchersCompare

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

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

enum
====

[](#enum)

[![Latest Version on Packagist](https://camo.githubusercontent.com/80d5fdc9dc71ce5f25bc7cebb44a3cbb1d9b61ec8033b1ec7dd4b3bd051d1c62/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6262726f74686572732f656e756d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bbrothers/enum)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/fd9d53e52357ac2e202bfa4d66a50391d89a06214efe96bd070fbaab3ca6d4a1/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6262726f74686572732f656e756d2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/bbrothers/enum)[![Coverage Status](https://camo.githubusercontent.com/964c6a29a6f3146f18cd72ecf267984ab2a3834242fe7b5b3385b686463af2ed/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6262726f74686572732f656e756d2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/bbrothers/enum/code-structure)[![Quality Score](https://camo.githubusercontent.com/3c630b3bfd60f9b4be4d65cf87a6531bd85b032d6823bd1bdaefe6ab8c1b1d9b/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6262726f74686572732f656e756d2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/bbrothers/enum)[![Total Downloads](https://camo.githubusercontent.com/e4944edaec42ebb1d0c4ce03eb76fd1c3d2b782e94eafba772eb76f84f28c040/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6262726f74686572732f656e756d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bbrothers/enum)

A very simple PHP Enum implementation.

Install
-------

[](#install)

Via Composer

```
$ composer require bbrothers/enum
```

Usage
-----

[](#usage)

```
class Weekdays extends Enum
{
    const MONDAY    = 'monday';
    const TUESDAY   = 'tuesday';
    const WEDNESDAY = 'wednesday';
    const THURSDAY  = 'thursday';
    const FRIDAY    = 'friday';
}
// ...
$day = Weekdays::TUESDAY();
$day->equals(Weekdays::MONDAY()); // false
$day->isSelected(Weekdays::TUESDAY); // true
(string) $day; // tuesday
Weekdays::values(); // monday, tuesday, wednesday, thursday, friday
Weekdays::keys(); // MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

Credits
-------

[](#credits)

- [Brad Brothers](https://github.com/bbrothers)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

3302d ago

### Community

Maintainers

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

---

Top Contributors

[![bbrothers](https://avatars.githubusercontent.com/u/2477338?v=4)](https://github.com/bbrothers "bbrothers (6 commits)")

---

Tags

enum

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[myclabs/php-enum

PHP Enum implementation

2.7k227.9M635](/packages/myclabs-php-enum)[dasprid/enum

PHP 7.1 enum implementation

379146.0M11](/packages/dasprid-enum)[spatie/enum

PHP Enums

84429.1M68](/packages/spatie-enum)[marc-mabe/php-enum

Simple and fast implementation of enumerations with native PHP

49444.8M97](/packages/marc-mabe-php-enum)[spatie/laravel-enum

Laravel Enum support

3655.4M31](/packages/spatie-laravel-enum)[consistence/consistence

Consistence - consistent approach and additions to PHP's functionality

1831.1M18](/packages/consistence-consistence)

PHPackages © 2026

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