bensampo/laravel-enum
Laravel Enum provides a powerful enum implementation for Laravel with class-constant definitions, instantiation, casting, validation, localization, bitwise/flag enums, and an artisan generator. Not recommended for new projects—use native PHP 8.1 enums.
int or string in conversion of Enum::hasValue() to native enumEnum::hasValue() to native enumphp artisan enum:to-native compatible with rector 0.19Enum::fromKey() to native enumphp artisan enum:to-nativephp artisan enum:to-nativephp artisan enum:to-nativeenum:to-native for simplified one-step conversion of classes that extend BenSampo\Enum\Enum to native PHP enumsBenSampo\Enum\Enum to native PHP enumsenum:to-native in favor of Rector conversionenum:to-native to convert a class that extends BenSampo\Enum\Enum to a native PHP enummixed in Enum::hasValue()enum:annotate commandEnum::$key and Enum::$description as non-nullable in Enum and document they are unset in FlaggedEnumphp artisan enum:annotate on long enum class 294EnumServiceProvider for customization 292asArray() to native enum automaticallyEnum::fromKey to native enum with dynamic class const fetch->value in enum:to-nativein() and notIn() to native enums when called with non-arraysTValue to Enum classEnum::getDescription() with invalid valuesInvalidEnumMemberException constructorEnum::getInstance() in favor or Enum::fromValue()Description attribute 264Enum::$key and Enum::$description as stringFlaggedEnum::$value as intDescription attribute.annotate command now uses composer to parse directories for instances of enums instead of hanneskod/classtoolsCastsEnums trait. Laravel attribute casting should be used now instead. 247addAllFlags() method to flagged enumsremoveAllFlags() method to flagged enumslaravel-ide-helper #165null when using native casting #152BenSampo\Enum\Enum, to ensure relational comparison (with <,>) uses the $value attribute. (Ref: https://www.php.net/manual/en/language.oop5.object-comparison.php#98725) #129EnumMethodReflection return generating constant values for isInternal, isDeprecated, and
getDeprecatedDescription #1210.12.x #119How can I help you explore Laravel packages today?