PackageTrack
Sign in Get early access

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 2026
2018 2019 2020 2021 2022 2023 2024 2025 2026
Release Pre-release

Releases

latest 60 of 104
  1. v6.14.0 29 Mar 2026
    Release notes

    Support Laravel 13 (#369)

    Open source →
    Release notes

    Added

    • Support Laravel 13
    Open source →
  2. 6.13.0 29 Mar 2026
    Release notes

    Convert asArray() to native enum automatically (#336)

    Open source →
    Release notes

    Added

    • Convert asArray() to native enum automatically
    Open source →
  3. v6.12.2 12 Aug 2025
    Release notes

    Simplify implementation of Enum::fromKey to native enum with dynami…

    Open source →
    Release notes

    Changed

    • Simplify implementation of Enum::fromKey to native enum with dynamic class const fetch
    Open source →
  4. v6.12.1 14 May 2025
    Release notes

    Handle NeverType when converting to native enums (#356)

    Open source →
    Release notes

    Fixed

    • Avoid false-positive addition of ->value in enum:to-native
    Open source →
  5. 6.12.0 25 Feb 2025
    Release notes

    Support Laravel 12 and Rector 2

    Open source →
    Release notes

    Added

    • Support Laravel 11
    • Support Rector 2
    Open source →
  6. v6.11.1 21 Aug 2024
    Release notes

    Fix conversion of in() and notIn() to native enums when called wi…

    Open source →
    Release notes

    Fixed

    • Fix conversion of in() and notIn() to native enums when called with non-arrays
    Open source →
  7. v6.11.0 19 Mar 2024
    Release notes

    Added

    • Support Laravel 11
    Open source →
  8. v6.10.0 14 Feb 2024
    Release notes

    Allow installation alongside PHPUnit 11 (#352)

    Open source →
    Release notes

    Added

    • Allow Allow installation alongside PHPUnit 11
    Open source →
  9. v6.9.1 13 Feb 2024
    Release notes
    • Check if value is int or string in conversion of `Enum::hasValu…
    Open source →
    Release notes

    Fixed

    • Check if value is int or string in conversion of Enum::hasValue() to native enum
    Open source →
  10. v6.9.0 13 Feb 2024
    Release notes

    Add conversion of Enum::hasValue() to native enum

    Open source →
    Release notes

    Added

    • Add conversion of Enum::hasValue() to native enum
    Open source →
  11. v6.8.0 12 Jan 2024
    Release notes

    Changed

    • Make php artisan enum:to-native compatible with rector 0.19
    Open source →
  12. v6.7.0 15 Nov 2023
    Release notes

    Added

    • Add PHPStan rule to detect duplicate enum values
    Open source →
  13. v6.6.4 26 Sep 2023
    Release notes

    Fixed

    • Fix conversion of Enum::fromKey() to native enum
    Open source →
  14. v6.6.3 31 Aug 2023
    Release notes

    Fixed

    • Remove leading backslash in class names passed to php artisan enum:to-native
    Open source →
  15. v6.6.2 03 Aug 2023
    Release notes

    Fixed

    • Convert single classes in one step with php artisan enum:to-native
    Open source →
  16. v6.6.1 03 Aug 2023
    Release notes

    Fixed

    • Disable timeout of rector calls in php artisan enum:to-native
    Open source →
  17. v6.6.0 31 Jul 2023
    Release notes

    Changed

    • Use command enum:to-native for simplified one-step conversion of classes that extend BenSampo\Enum\Enum to native PHP enums
    Open source →
  18. v6.5.0 31 Jul 2023
    Release notes

    Added

    • Add Rector rules for conversion of classes that extend BenSampo\Enum\Enum to native PHP enums

    Deprecated

    • Deprecate command enum:to-native in favor of Rector conversion
    Open source →
  19. v6.4.1 10 Jul 2023
    Release notes

    Fixed

    • Ensure validation rules are always added https://github.com/BenSampo/laravel-enum/pull/327
    Open source →
  20. v6.4.0 05 Jul 2023
    Release notes

    Added

    • Add command enum:to-native to convert a class that extends BenSampo\Enum\Enum to a native PHP enum

    Fixed

    • Load pipe-string syntax validation translations lazily https://github.com/BenSampo/laravel-enum/pull/324
    Open source →
  21. v6.3.3 18 May 2023
    Release notes

    Fixed

    • Allow mixed in Enum::hasValue()
    Open source →
  22. v6.3.2 09 May 2023
    Release notes

    Fixed

    • Preserve whitespace in PHPDocs when running enum:annotate command
    Open source →
  23. v6.3.1 13 Feb 2023
    Release notes

    Fixed

    • Mark Enum::$key and Enum::$description as non-nullable in Enum and document they are unset in FlaggedEnum
    Open source →
  24. v6.3.0 31 Jan 2023
    Release notes

    Added

    • Support Laravel 10 298
    Open source →
  25. v6.2.2 17 Jan 2023
    Release notes

    Fixed

    • Fix backtrack regexp error and add Windows EOL support to the annotate command 296
    Open source →
  26. v6.2.1 12 Jan 2023
    Release notes

    Fixed

    • Fix running php artisan enum:annotate on long enum class 294
    Open source →
  27. v6.2.0 07 Dec 2022
    Release notes

    Changed

    • Open EnumServiceProvider for customization 292
    Open source →
  28. v6.1.0 26 Oct 2022
    Release notes

    Changed

    • Eliminate unnecessary abstract class AbstractAnnotationCommand 283

    Fixed

    • Provide more accurate type hints in Enum and FlaggedEnum 283
    • Accept FlaggedEnum instances in QueriesFlaggedEnums scopes 283
    Open source →
  29. v6.0.0 12 Aug 2022
    Release notes

    Added

    • Allow Description attribute usage on class 270
    • Add generic type TValue to Enum class

    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 InvalidEnumMemberException constructor

    Fixed

    • Leverage late static binding for instantiation methods in PHPStan extension

    Removed

    • Remove Enum::getInstance() in favor or Enum::fromValue()
    Open source →
  30. v5.3.1 22 Jun 2022
    Release notes

    Fixed

    • Narrow property type hints 258
    Open source →
  31. v5.3.0 08 Apr 2022
    Release notes

    Fixed

    • Return value for invalid enum case when using the Description attribute 264

    Fixed

    • Type-hint Enum::$key and Enum::$description as string
    • Type-hint FlaggedEnum::$value as int
    Open source →
  32. v5.2.0 11 Mar 2022
    Release notes

    Fixed

    • Publish language definitions to lang directory 254

    Added

    • Restore enum instance from var_export() 252
    Open source →
  33. v5.1.0 09 Feb 2022
    Release notes

    Added

    • Ability to define enum case descriptions using Description attribute.
    Open source →
  34. v5.0.0 09 Feb 2022
    Release notes

    Added

    • Support for Laravel 9

    Changed

    • The annotate command now uses composer to parse directories for instances of enums instead of hanneskod/classtools

    Removed

    • Removed old CastsEnums trait. Laravel attribute casting should be used now instead. 247
    Open source →
  35. v4.2.0 31 Jan 2022
    Release notes

    Fixed

    • Fix return type on FlaggedEnum flags method 241
    • Suppress deprecated notice on PHP8.1 236
    Open source →
  36. v4.1.0 16 Nov 2021
    Release notes

    Added

    • Allow package to be installed with PHP 8.1 #233

    Changed

    • Allow laminas/laminas-code:^4.0 as a dependency #233
    Open source →
  37. v4.0.0 09 Nov 2021
    Release notes

    Fixed

    • Fixed validation error message localization when using string validation rules #227

    Changed

    • Extend the functionality of the getKeys() and getValues() methods #223

    Added

    • Added new method notIn() to check whether a value is not in an iterable set of values #232
    Open source →
  38. v3.4.2 09 Sep 2021
    Release notes

    Fixed

    • Fixed broken enums due to wrapping of long constant names in method annotations #226
    Open source →
  39. v3.4.1 17 Jun 2021
    Release notes

    Fixed

    • Fixed type issued in PHP 7.3
    Open source →
  40. v3.4.0 17 Jun 2021
    Release notes

    Added

    • addAllFlags() method to flagged enums
    • removeAllFlags() method to flagged enums

    Fixed

    • Fixed coercion of flagged enums when the value represents multiple flags
    Open source →
  41. v3.3.0 16 Feb 2021
    Release notes

    Changed

    • Update doctrine/dbal requirement from ^2.9 to ^2.9|^3.0 #208
    • Allow passing iterables to Enum::in() #212

    Fixed

    • fix: $model->getChanges() triggered due to strict comparison #187
    • Fixed issue in getFriendlyKeyNamewhen uppercase key contains non-alpha characters #210
    Open source →
  42. v3.2.0 15 Dec 2020
    Release notes

    Added

    • PHP 8.0 support #203

    Changed

    • Switched from Travis to GitHub Actions
    Open source →
  43. v3.1.0 22 Oct 2020
    Release notes

    Added

    • Added trait to query flagged enums using Eloquent #180
    • Add the option to publish enums stubs #182

    Changed

    • Improved test equality strictness #185

    Fixed

    • fix:toSelectArray breaking change + document toArray change #184
    Open source →
  44. v3.0.0 07 Sep 2020
    Release notes

    Added

    • Support for Laravel 8

    Fixed

    • Model annotation has been removed in favour of laravel-ide-helper #165
    Open source →
  45. v2.2.0 30 Aug 2020
    Release notes

    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 use Enum::asArray().
    Open source →
  46. v2.1.0 24 Jul 2020
    Release notes

    Fixed

    • Allow returning null when using native casting #152
    Open source →
  47. v2.0.0 02 Jul 2020
    Release notes

    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
    Open source →
  48. v1.38.0 07 Jun 2020
    Release notes

    Fixed

    • Handle calling magic instantiation methods from within instance methods of the Enum #147
    • Add new instantiation methods Enum::fromKey() and Enum::fromValue() #142
    • Fixed issue with localized validation messages #141

    Deprecated

    • Deprecate Enum::getInstance() in favor of Enum::fromValue()
    Open source →
  49. v1.37.0 11 Apr 2020
    Release notes

    Changed

    • EnumValue validation rule allows multiple flags for FlaggedEnums
    Open source →
  50. v1.28.3 05 Dec 2019

    Nothing published for this version

  51. v1.28.2 05 Dec 2019

    Nothing published for this version

  52. v1.28.1 28 Nov 2019

    Nothing published for this version

  53. v1.26.1 17 Sep 2019

    Nothing published for this version

  54. v1.21.3 30 Jul 2019

    Nothing published for this version

  55. v1.21.2 17 Jul 2019

    Nothing published for this version

  56. v1.21.1 15 Jul 2019

    Nothing published for this version

  57. v1.19.1 03 Jun 2019

    Nothing published for this version

  58. 1.18.2 08 May 2019

    Nothing published for this version

  59. 1.18.1 05 May 2019

    Nothing published for this version

  60. 1.17.1 05 Mar 2019

    Nothing published for this version

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive