hell-sh / enum
A simple, abstract class to improve your 'enums'.
v1.2.1
2021-02-06 02:18 UTC
Requires
- php: >=7.1
README
A simple, abstract class to improve your 'enums'.
Usage
composer require hell-sh/enum ^1.0
- Make your enum(s) extend
hellsh\Enum
:namespace MyNamespace; use hellsh\Enum; final class MyEnum extends Enum { const ONE = "Eins"; const TWO = "Zwei"; }
- Enjoy the added methods:
MyEnum::valueOf(string $name)
MyEnum::all(): array
MyEnum::nameOf($value): ?string
MyEnum::validateName(string $name): bool
MyEnum::validateValue($value): bool