Just like Spatie's PHP Enum, you can add labels to your enums. This is largely backwards compatible with their package, except that it also works for basic enums in which case it returns the name if not specified.
use Henzeb\Enumhancer\Concerns\Labels;
enum YourEnum {
use Labels;
case ENUM;
case NO_LABEL;
public static function labels(): array
{
return [
'ENUM' => 'Your label';
];
}
}
YourEnum::ENUM->label(); // will return 'Your label'
YourEnum::NO_LABEL->label(); // will return 'NO_LABEL';