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

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

olegstyle/enum
==============

PHP Enumerator

v1.1.0(4y ago)210.8k↓51.5%MITPHPPHP &gt;=7.1

Since Mar 17Pushed 4y ago1 watchersCompare

[ Source](https://github.com/olegstyle/enum)[ Packagist](https://packagist.org/packages/olegstyle/enum)[ Docs](https://bodev.pro)[ RSS](/packages/olegstyle-enum/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)DependenciesVersions (6)Used By (0)

PHP Enumerator
==============

[](#php-enumerator)

Requires
========

[](#requires)

PHP &gt;= 7.1

Installation
============

[](#installation)

#### 1. Append to composer package requires

[](#1-append-to-composer-package-requires)

```
composer require olegstyle/enum

```

#### 2. Use it `^_^`

[](#2-use-it-_)

Usage
=====

[](#usage)

#### 1. Create new class

[](#1-create-new-class)

```
/**
 * -- Magic methods
 * @method static static EXPIRED()
 * @method static static ERROR()
 * @method static static STARTED()
 * @method static static PENDING()
 * @method static static DONE()
 */
class StatusEnum extends OlegStyle\Enum\Enum
{
    EXPIRED = -2;
    ERROR = -1;
    STARTED = 0;
    PENDING = 1;
    DONE  = 2;
}
```

#### 2. use it like this

[](#2-use-it-like-this)

```
$started = StatusEnum::STARTED(); // will return Enum object by magik command
$error = StatusEnum::instanceFromValue(-1); // will be created object from value
$expired = new StatusEnum(-2); // will be created object from value

$isExpired = $started->isEqual(StatusEnum::EXPIRED()); // will be returned false
$isExpired2 = $expired->isEqual(-2); // will be returned true
$isExpired3 = $started->isEqual('0'); // will be returned false because is using strict mode comparation
$isStartedKey = $started->isEqualKey('STARTED'); // will be returned true
$isStartedKeyEnum = $started->isEqualKey(StatusEnum::STARTED()); // will be returned true

$array = StatusEnum::toArray(); // will be return all constants from StatusEnum class
$pendingKey = StatusEnum::search(1); // will be returned contant name - 'PENDING'
$unknownKey = StatusEnum::search('1'); // will be returned null because is using strict mode
$pendingKey = StatusEnum::getName(1); // similar to search

StatusEnum::isValid(2); // valid key. should be returned true
StatusEnum::isValid('2'); // should be returned false because is using strict mode
```

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

Established project with proven stability

 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

Every ~414 days

Total

4

Last Release

1786d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/22445702?v=4)[Oleh Borysenko](/maintainers/olegstyle)[@olegstyle](https://github.com/olegstyle)

---

Top Contributors

[![olegstyle](https://avatars.githubusercontent.com/u/22445702?v=4)](https://github.com/olegstyle "olegstyle (2 commits)")

### Embed Badge

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

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

###  Alternatives

[symfony/property-access

Provides functions to read and write from/to an object or array using a simple string notation

2.8k317.3M3.2k](/packages/symfony-property-access)[malzariey/filament-daterangepicker-filter

This package uses daterangepciker library to filter date by a range or predefined date ranges (Today , Yesterday ...etc)

1772.3M23](/packages/malzariey-filament-daterangepicker-filter)[roxblnfk/unpoly

Remove unnecessary PHP polyfills

4135.8k17](/packages/roxblnfk-unpoly)

PHPackages © 2026

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