fatcode / enum
Enumeration library for connoisseurs.
1.1.0
2019-03-26 18:50 UTC
Requires
- php: >=7.2.0
Requires (Dev)
- phpunit/phpunit: >=8.0
- squizlabs/php_codesniffer: >=3.0
This package is auto-updated.
Last update: 2024-11-11 22:51:38 UTC
README
Enumeration library for connoisseurs.
Installation
composer install fatcode/enum
Enum declaration
<?php use FatCode\Enum; class Colors extends Enum { public const RED = 'red'; public const GREEN = 'green'; protected const INVISIBLE_COLOR = 'invisible_color'; }
Enum usage
<?php // $red is instance of Enum with value 'red' $red = Colors::RED(); $red->getValue(); // "red" $red->getKey();// "RED"