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

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

werkspot/enum
=============

Werkspot's Enum Library

v3.0(6y ago)2193.9k↓38.5%16MITPHPPHP &gt;=7.3CI failing

Since Mar 24Pushed 6y ago31 watchersCompare

[ Source](https://github.com/Werkspot/Enum)[ Packagist](https://packagist.org/packages/werkspot/enum)[ RSS](/packages/werkspot-enum/feed)WikiDiscussions master Synced yesterday

READMEChangelog (6)Dependencies (2)Versions (7)Used By (6)

Enum
====

[](#enum)

This package holds a simple class that may be used as an ancestor for your enum classes.

[![Build Status](https://camo.githubusercontent.com/3443e320643d31389e964b7b7b14e801d43ca640230f70b08ad7388be7b27b2c/68747470733a2f2f7472617669732d63692e636f6d2f5765726b73706f742f456e756d2e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/Werkspot/Enum)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/67bda698424741f71eae45c3c9ef57193854d63289ab900d582c6bc961cd473a/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f5765726b73706f742f456e756d2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Werkspot/Enum/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/c513f18604b74d7319d030b4f853d95d5db0c590783e2e2b77d2be75c7ec3f15/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f5765726b73706f742f456e756d2f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Werkspot/Enum/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/809b643d8664f59e8d79356c9d4deb85a6cf37d3d9abca86d5ae55330ca9dce2/68747470733a2f2f706f7365722e707567782e6f72672f7765726b73706f742f656e756d2f762f737461626c65)](https://packagist.org/packages/werkspot/enum)[![License](https://camo.githubusercontent.com/2805b777a933b258d4fb39375119b08de305b5be0596e2896fbf0b25ca170729/68747470733a2f2f706f7365722e707567782e6f72672f7765726b73706f742f656e756d2f6c6963656e7365)](https://packagist.org/packages/werkspot/enum)

### Install

[](#install)

`# composer require werkspot/enum`

### Usage

[](#usage)

Extend the Werkspot\\Enum\\AbstractEnum, define your enum key values as constants.

```
namespace YourAwesomeOrganisation\Project;

use Werkspot\Enum\AbstractEnum;

/**
 * @method static FooEnum foo()
 * @method bool isFoo()
 * @method static FooEnum bar()
 * @method bool isBar()
 * @method static FooEnum baz()
 * @method bool isBaz()
 */
final class FooEnum extends AbstractEnum
{
    const FOO = 'foo';
    const BAR = 'bar';
    const BAZ = 'baz';
}
```

Now you can use the enum in a class:

```
namespace YourAwesomeOrganisation\Project;

final class Bar
{
    /** @var FooEnum */
    private $enum;

    punblic function __construct(FooEnum $enum)
    {
        $this->enum = $enum;
    }

    public function getEnum(): FooEnum
    {
        return $this->enum;
    }
}
```

Implementation of that class

```
$fooEnum = FooEnum::baz();
$bar = new Bar($fooEnum);

$enum = $bar->getEnum();
$value = $enum->getValue(); // will return 'baz'
```

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community24

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 87.5% 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 ~304 days

Recently: every ~380 days

Total

6

Last Release

2233d ago

Major Versions

v1.0.2 → v2.02017-09-19

v2.1 → v3.02020-05-22

PHP version history (3 changes)v1.0PHP &gt;=5.6.5

v2.0PHP &gt;=7.1

v3.0PHP &gt;=7.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/37301ff25cf2c512e7c1079160028e6e4c27194b6ba6d44aa52213ba2e3feaac?d=identicon)[jeroenvdheuvel](/maintainers/jeroenvdheuvel)

![](https://www.gravatar.com/avatar/99d3da37dfb742ac4a51091f756f8a632cc9d4a12f433fe3c6a51056808372f6?d=identicon)[werkspot](/maintainers/werkspot)

![](https://avatars.githubusercontent.com/u/516326?v=4)[Winfred Peereboom](/maintainers/wpeereboom)[@wpeereboom](https://github.com/wpeereboom)

---

Top Contributors

[![LauLaman](https://avatars.githubusercontent.com/u/8283992?v=4)](https://github.com/LauLaman "LauLaman (14 commits)")[![ferrastas](https://avatars.githubusercontent.com/u/116074?v=4)](https://github.com/ferrastas "ferrastas (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k543.8M20.1k](/packages/laravel-framework)[illuminate/support

The Illuminate Support package.

630113.0M41.3k](/packages/illuminate-support)[api-platform/core

Build a fully-featured hypermedia or GraphQL API in minutes!

2.6k51.2M339](/packages/api-platform-core)[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k118.7M719](/packages/symfony-maker-bundle)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[api-platform/metadata

API Resource-oriented metadata attributes and factories

275.0M219](/packages/api-platform-metadata)

PHPackages © 2026

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