bensampo/laravel-enum
Simple, extensible and powerful enumeration implementation for Laravel.
v6.14.0
17M downloads/mo
#1280 most downloaded on Packagist
BenSampo/laravel-enum
What this package is like to depend on
Last release 4 months ago
29 Mar 2026
Release timing varies
gaps range from 4 weeks to 8 months
Some releases are documented
notes for 49 of 104 stable releases
Nothing withdrawn
no release was ever pulled
9 years old
104 releases · first in 2017
2 releases in the last 12 months
see the full history below
Release timeline
103 releases · Sep 2017 to Mar 2026Releases
latest 60 of 104-
v6.14.029 Mar 2026 -
6.13.029 Mar 2026 -
v6.12.212 Aug 2025Release notes
Open source →Changed
- Simplify implementation of
Enum::fromKeyto native enum with dynamic class const fetch
- Simplify implementation of
-
v6.12.114 May 2025 -
6.12.025 Feb 2025 -
v6.11.121 Aug 2024Release notes
Open source →Fixed
- Fix conversion of
in()andnotIn()to native enums when called with non-arrays
- Fix conversion of
-
v6.11.019 Mar 2024 -
v6.10.014 Feb 2024 -
v6.9.113 Feb 2024Release notes
Open source →Fixed
- Check if value is
intorstringin conversion ofEnum::hasValue()to native enum
- Check if value is
-
v6.9.013 Feb 2024 -
v6.8.012 Jan 2024 -
v6.7.015 Nov 2023 -
v6.6.426 Sep 2023 -
v6.6.331 Aug 2023Release notes
Open source →Fixed
- Remove leading backslash in class names passed to
php artisan enum:to-native
- Remove leading backslash in class names passed to
-
v6.6.203 Aug 2023Release notes
Open source →Fixed
- Convert single classes in one step with
php artisan enum:to-native
- Convert single classes in one step with
-
v6.6.103 Aug 2023 -
v6.6.031 Jul 2023Release notes
Open source →Changed
- Use command
enum:to-nativefor simplified one-step conversion of classes that extendBenSampo\Enum\Enumto native PHP enums
- Use command
-
v6.5.031 Jul 2023Release notes
Open source →Added
- Add Rector rules for conversion of classes that extend
BenSampo\Enum\Enumto native PHP enums
Deprecated
- Deprecate command
enum:to-nativein favor of Rector conversion
- Add Rector rules for conversion of classes that extend
-
v6.4.110 Jul 2023Release notes
Open source →Fixed
- Ensure validation rules are always added https://github.com/BenSampo/laravel-enum/pull/327
-
v6.4.005 Jul 2023Release notes
Open source →Added
- Add command
enum:to-nativeto convert a class that extendsBenSampo\Enum\Enumto a native PHP enum
Fixed
- Load pipe-string syntax validation translations lazily https://github.com/BenSampo/laravel-enum/pull/324
- Add command
-
v6.3.318 May 2023 -
v6.3.209 May 2023 -
v6.3.113 Feb 2023Release notes
Open source →Fixed
- Mark
Enum::$keyandEnum::$descriptionas non-nullable inEnumand document they are unset inFlaggedEnum
- Mark
-
v6.3.031 Jan 2023 -
v6.2.217 Jan 2023Release notes
Open source →Fixed
- Fix backtrack regexp error and add Windows EOL support to the annotate command 296
-
v6.2.112 Jan 2023 -
v6.2.007 Dec 2022 -
v6.1.026 Oct 2022Release notes
Open source → -
v6.0.012 Aug 2022Release notes
Open source →Added
- Allow Description attribute usage on class 270
- Add generic type
TValuetoEnumclass
Changed
- Require composer/class-map-generator over composer/composer 268
- Use native types whenever possible
- Throw when calling
Enum::getDescription()with invalid values - Expect class-string in
InvalidEnumMemberExceptionconstructor
Fixed
- Leverage late static binding for instantiation methods in PHPStan extension
Removed
- Remove
Enum::getInstance()in favor orEnum::fromValue()
-
v5.3.122 Jun 2022 -
v5.3.008 Apr 2022Release notes
Open source →Fixed
- Return value for invalid enum case when using the
Descriptionattribute 264
Fixed
- Type-hint
Enum::$keyandEnum::$descriptionasstring - Type-hint
FlaggedEnum::$valueasint
- Return value for invalid enum case when using the
-
v5.2.011 Mar 2022Release notes
Open source →Fixed
- Publish language definitions to
langdirectory 254
Added
- Restore enum instance from
var_export()252
- Publish language definitions to
-
v5.1.009 Feb 2022Release notes
Open source →Added
- Ability to define enum case descriptions using
Descriptionattribute.
- Ability to define enum case descriptions using
-
v5.0.009 Feb 2022Release notes
Open source →Added
- Support for Laravel 9
Changed
- The
annotatecommand now uses composer to parse directories for instances of enums instead ofhanneskod/classtools
Removed
- Removed old
CastsEnumstrait. Laravel attribute casting should be used now instead. 247
-
v4.2.031 Jan 2022Release notes
Open source → -
v4.1.016 Nov 2021Release notes
Open source →Added
- Allow package to be installed with PHP 8.1 #233
Changed
- Allow
laminas/laminas-code:^4.0as a dependency #233
-
v4.0.009 Nov 2021Release notes
Open source →Fixed
- Fixed validation error message localization when using string validation rules #227
Changed
- Extend the functionality of the
getKeys()andgetValues()methods #223
Added
- Added new method
notIn()to check whether a value is not in an iterable set of values #232
-
v3.4.209 Sep 2021Release notes
Open source →Fixed
- Fixed broken enums due to wrapping of long constant names in method annotations #226
-
v3.4.117 Jun 2021 -
v3.4.017 Jun 2021Release notes
Open source →Added
addAllFlags()method to flagged enumsremoveAllFlags()method to flagged enums
Fixed
- Fixed coercion of flagged enums when the value represents multiple flags
-
v3.3.016 Feb 2021Release notes
Open source →Changed
- Update doctrine/dbal requirement from ^2.9 to ^2.9|^3.0 #208
- Allow passing iterables to Enum::in() #212
Fixed
-
v3.2.015 Dec 2020Release notes
Open source → -
v3.1.022 Oct 2020Release notes
Open source →Added
Changed
- Improved test equality strictness #185
Fixed
- fix:
toSelectArraybreaking change + documenttoArraychange #184
-
v3.0.007 Sep 2020Release notes
Open source →Added
- Support for Laravel 8
Fixed
- Model annotation has been removed in favour of
laravel-ide-helper#165
-
v2.2.030 Aug 2020Release notes
Open source →Fixed
- Model attributes which use Laravel 7 native casting now return the enum value when serialized. #162 #163
Deprecated
Enum::toArray()should no longer be called statically, instead useEnum::asArray().
-
v2.1.024 Jul 2020 -
v2.0.002 Jul 2020Release notes
Open source →Added
- Native attribute casting #131
Changed
- Require Laravel 7.5 or higher
- Require PHP 7.2.5 or higher
Deprecated
- Deprecate legacy attribute casting in favor of native casting
-
v1.38.007 Jun 2020Release notes
Open source →Fixed
- Handle calling magic instantiation methods from within instance methods of the Enum #147
- Add new instantiation methods
Enum::fromKey()andEnum::fromValue()#142 - Fixed issue with localized validation messages #141
Deprecated
- Deprecate
Enum::getInstance()in favor ofEnum::fromValue()
-
v1.37.011 Apr 2020Release notes
Open source →Changed
- EnumValue validation rule allows multiple flags for FlaggedEnums
-
v1.28.305 Dec 2019Nothing published for this version
-
v1.28.205 Dec 2019Nothing published for this version
-
v1.28.128 Nov 2019Nothing published for this version
-
v1.26.117 Sep 2019Nothing published for this version
-
v1.21.330 Jul 2019Nothing published for this version
-
v1.21.217 Jul 2019Nothing published for this version
-
v1.21.115 Jul 2019Nothing published for this version
-
v1.19.103 Jun 2019Nothing published for this version
-
1.18.208 May 2019Nothing published for this version
-
1.18.105 May 2019Nothing published for this version
-
1.17.105 Mar 2019Nothing published for this version