PackageTrack
Sign in Get early access

spatie/enum

PHP Enums

3.13.0 35M downloads/mo #599 most downloaded on Packagist spatie/enum

What this package is like to depend on

Last release 4 years ago

no release in 18 months

Release timing varies

gaps range from 4 weeks to 5 months

Nearly every release is documented

notes for 40 of 44 stable releases

Nothing withdrawn

no release was ever pulled

8 years old

44 releases · first in 2019

0 releases in the last 12 months

see the full history below

Release timeline

43 releases · Feb 2019 to Apr 2022
2020 2021 2022 2023 2024 2025 2026
Release Pre-release

Releases

latest 44
  1. 3.13.0 22 Apr 2022
    Release notes

    What's Changed

    • Implement Stringable interface on Enum by @jdecool in #116

    New Contributors

    Full Changelog: 3.12.0...3.13.0

    Open source →
    Release notes
    • Drop PHP 7.4 support
    • Add Stringable interface to enum class - #116
    Open source →
  2. 3.12.0 05 Feb 2022
    Release notes
    • Add support for isset() calls to enum ->value und ->label - #109
    Open source →
    Release notes
    • Add support for isset() calls to enum ->value und ->label - #109
    Open source →
  3. 3.11.1 25 Nov 2021
    Release notes
    • Change attribute for PHP 8.1 compatibility
    Open source →
    Release notes
    • Change attribute for PHP 8.1 compatibility
    Open source →
  4. 3.11.0 25 Nov 2021
    Release notes
    • Added support for PHP 8.1
    Open source →
    Release notes
    • Added support for PHP 8.1
    Open source →
  5. 3.10.0 20 Oct 2021
    Release notes
    • Fix from() and tryFrom() methods to do PHP type-juggling (string to integer) - #108
    • Fix tryFrom() method to catch scalar type-errors - #105
    Open source →
    Release notes
    • Fix from() and tryFrom() methods to do PHP type-juggling (string to integer) - #108
    • Fix tryFrom() method to catch scalar type-errors - #105
    Open source →
  6. 3.9.0 10 May 2021
    Release notes
    • Add from() and tryFrom() methods to get closer to PHP8.1 native enums - #94
    • Deprecate make() in favor of from() method - #94
    • Add flyweight pattern to return the same enum instance for every call - #94
    Open source →
    Release notes
    • Add from() and tryFrom() methods to get closer to PHP8.1 native enums - #94
    • Deprecate make() in favor of from() method - #94
    • Add flyweight pattern to return the same enum instance for every call - #94
    Open source →
  7. 3.8.0 12 Apr 2021
    Release notes
    • Add cases() method to retrieve all instances of the enum - #79
    Open source →
    Release notes
    • Add cases() method to retrieve all instances of the enum - #79
    Open source →
  8. 3.7.2 10 Mar 2021
    Release notes
    • Fix problem with @readonly annotation and annotation parsing libraries - #92
    Open source →
    Release notes
    • Fix problem with @readonly annotation and annotation parsing libraries - #92
    Open source →
  9. 3.7.1 12 Feb 2021
    Release notes
    • Add description to PHPUnit assertion methods - #88
    Open source →
    Release notes
    • Add description to PHPUnit assertion methods - #88
    Open source →
  10. 3.7.0 13 Jan 2021
    Release notes
    • Add ability to use a Closure as value/label map - #87
    Open source →
    Release notes
    • Add ability to use a Closure as value/label map - #87
    Open source →
  11. 3.6.4 13 Jan 2021
    Release notes
    • Add psalm annotations to seal and lock internals - #85
    Open source →
  12. 3.6.3 12 Jan 2021
    Release notes
    • Fix extra whitespaces in enum definition doc-blocks - #86
    Open source →
  13. 3.6.2 17 Dec 2020
    Release notes
    • Fix issue with enums not callable within enum classes - #82
    Open source →
  14. 3.6.1 26 Nov 2020

    Nothing published for this version

  15. 3.6.0 no date
    Release notes
    • Add assertIsEnumValue() and assertIsEnumLabel() to \Spatie\Enum\Phpunit\EnumAssertions - #80
    Open source →
  16. 3.5.1 19 Nov 2020
    Release notes
    • Fix \Spatie\Enum\Enum php-doc @property-read annotations - #78
    Open source →
  17. 3.5.0 22 Oct 2020
    Release notes
    • Add Faker provider to generate random enum instances, values and labels \Spatie\Enum\Faker\FakerEnumProvider - #74
    Open source →
  18. 3.4.0 22 Oct 2020
    Release notes
    • Add \Spatie\Enum\Enum::toValues() and \Spatie\Enum\Enum::toLabels() methods - #72
    Open source →
  19. 3.3.0 21 Oct 2020
    Release notes
    • Add \Spatie\Enum\Phpunit\EnumAssertions with a default set of assertions - #71
    Open source →
  20. 3.2.0 08 Oct 2020
    Release notes
    • Support PHP ^8.0
    Open source →
  21. 3.1.2 28 Sep 2020
    Release notes
    • Don't cast value to string when serializing to JSON - #68
    Open source →
  22. 3.1.1 28 Aug 2020
    Release notes
    • Throw TypeError if value passed to Enum construct is not string or integer
    Open source →
  23. 3.1.0 28 Aug 2020
    Release notes

    #64

    • Add missing type-hints and doc-blocks
    • Fix unique values and labels
    • Flag EnumDefinition as internal
    Open source →
  24. 3.0.0 22 Jul 2020
    Release notes
    • A complete overhaul of the package, all details are discussed in the PR
    Open source →
  25. 2.3.8 17 Jul 2020
    Release notes
    • Fix for static isXyz($value) magic methods tto return false on invalid value - follow up fix to v2.3.3 - #62
    Open source →
  26. 2.3.7 30 Jun 2020
    Release notes
    • Fix internal usage of toArray() to allow custom array representations #58
    Open source →
  27. 2.3.6 11 Mar 2020
    Release notes
    • Fix the name if it's matched but isn't the same #50
    Open source →
  28. 2.3.5 11 Feb 2020
    Release notes
    • Fix for isEqual() and isAny() method doc-tags to accept mixed values
    Open source →
  29. 2.3.4 17 Jan 2020
    Release notes
    • Fix for static method call passed to __call within the context of an object
    Open source →
  30. 2.3.3 25 Sep 2019
    Release notes
    • Allow passing invalid string values to isEqual() #39
    Open source →
  31. 2.3.2 05 Sep 2019

    Nothing published for this version

  32. 2.3.1 19 Aug 2019
    Release notes
    • Fix protected method calls to allow overrides #37
    Open source →
  33. 2.3.0 05 Aug 2019
    Release notes
    • Make \Spatie\Enum\Enumerable::isValidIndex/Name/Value() methods public #36
    • Please note that this could be breaking for custom implementations of the \Spatie\Enum\Enumerable interface.

    Open source →
  34. 2.2.0 18 Jul 2019
    Release notes
    • Add \Spatie\Enum\Enum::getAll() method #33
    Open source →
  35. 2.1.2 07 May 2019
    Release notes
    • Fix calling public non-static methods #32
    Open source →
  36. 2.1.1 18 Apr 2019
    Release notes
    • Fix overriden existing public static methods like Enum::toArray() #29
    Open source →
  37. 2.1.0 17 Apr 2019
    Release notes
    • Add enum map index and value Enum::MAP_INDEX and Enum::MAP_VALUE #25
    Open source →
  38. 2.0.1 08 Apr 2019
    Release notes
    • Improved static analysis support for ::make
    Open source →
  39. 2.0.0 01 Apr 2019
    Release notes

    A full major rework of the Enum class - we try to list all changes, for more details you can check out the PR and the Issue.

    • Add \Spatie\Enum\Enumerable interface
    • Add \Spatie\Enum\Exceptions\DuplicatedIndexException, \Spatie\Enum\Exceptions\DuplicatedValueException, \Spatie\Enum\Exceptions\InvalidIndexException and \Spatie\Enum\Exceptions\InvalidValueException exceptions
    • Add \Spatie\Enum\Enum->getIndex() method
    • Add \Spatie\Enum\Enum::getIndices() method
    • Add \Spatie\Enum\Enum->getValue() method
    • Add \Spatie\Enum\Enum::getValues() method
    • Rename \Spatie\Enum\Enum::from() to \Spatie\Enum\Enum::make()
    • Rename \Spatie\Enum\Enum::equals() to \Spatie\Enum\Enum::isEqual()
    • Rename \Spatie\Enum\Enum::isOneOf() to \Spatie\Enum\Enum::isAny()
    • Change \Spatie\Enum\Enum->__construct() signature and responsibility - only take index & value and validate them
    • Change \Spatie\Enum\Enum::toArray() return value instead of an array of value => name it returns value => index
    • Drop recursive \Spatie\Enum\Enum::make() support from inside of an unstatic method
    • Drop \Spatie\Enum\Enum::$map in favor of \Spatie\Enum\Enum->getIndex()and \Spatie\Enum\Enum->getValue()
    • Update all methods have strict type checks: index: int and value: string
    • Update all methods are compatible with all required types: index, value, name or instance of Enum
    Open source →
  40. 1.1.0 18 Mar 2019
    Release notes
    • Add support for is* checks
    Open source →
  41. 1.0.2 18 Mar 2019
    Release notes
    • Support case insensitive enum values (#13)
    Open source →
  42. 1.0.1 14 Mar 2019

    Nothing published for this version

  43. 1.0.0 08 Feb 2019
    Release notes
    • initial release
    Open source →
  44. 0.0.1 07 Feb 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