PHPackages                             cascademedia/php-enumerators - 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. cascademedia/php-enumerators

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

cascademedia/php-enumerators
============================

Provides an abstraction to emulate enumerators in PHP.

16PHP

Since Jan 15Pushed 11y ago3 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

PHP Enumerators
===============

[](#php-enumerators)

This library provides an abstraction to emulate enumerators in PHP.

Installation
------------

[](#installation)

To install php-enumerators, simply require the library by executing the following composer command.

```
$ composer require cascademedia/php-enumerators:dev-master

```

Alternatively, you can clone/download this repository and install the package manually.

Usage
-----

[](#usage)

```
class TokenType extends AbstractEnumerator
{
    const STRING = 'token_string';
    const NUMBER = 'token_number';
}

function read_token_type(TokenType $type)
{
    switch ($type) {
        case TokenType::STRING():
            // The token type is a string!
            break;
        case TokenType::NUMBER():
            // The token type is a number!
            break;
        default:
            break;
    }
}

$tokenType = TokenType::STRING();

read_token_type($tokenType);
```

License
-------

[](#license)

This library is MIT licensed, meaning it is free for anyone to use and modify.

```
Copyright (c) 2015 Cascade Media, LLC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/d749ac0a0f0c2e479074aab7d3027392814ec71b882ab362c90637db2e62e82e?d=identicon)[estel.smith](/maintainers/estel.smith)

---

Top Contributors

[![estelsmith](https://avatars.githubusercontent.com/u/363670?v=4)](https://github.com/estelsmith "estelsmith (10 commits)")

### Embed Badge

![Health badge](/badges/cascademedia-php-enumerators/health.svg)

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

PHPackages © 2026

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