Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Enum Laravel Package

spatie/enum

Obsolete: PHP 8.1+ has native enums (recommended). Spatie Enum provides strongly typed, object-based enums for older PHP versions, enabling IDE-friendly static analysis and refactoring. Define enums via @method annotations and call StatusEnum::draft().

View on GitHub
Deep Wiki
Context7
3.13.0

What's Changed

New Contributors

Full Changelog: https://github.com/spatie/enum/compare/3.12.0...3.13.0

3.12.0
  • Add support for isset() calls to enum ->value und ->label - #109
3.11.1
  • Change attribute for PHP 8.1 compatibility
3.11.0
  • Added support for PHP 8.1
3.10.0
  • Fix from() and tryFrom() methods to do PHP type-juggling (string to integer) - #108
  • Fix tryFrom() method to catch scalar type-errors - #105
3.9.0
  • 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
3.8.0
  • Add cases() method to retrieve all instances of the enum - #79
3.7.2
  • Fix problem with [@readonly](https://github.com/readonly) annotation and annotation parsing libraries - #92
3.7.1
  • Add description to PHPUnit assertion methods - #88
3.7.0
  • Add ability to use a Closure as value/label map - #87
3.6.4
  • Add psalm annotations to seal and lock internals - #85
3.6.3
  • Fix extra whitespaces in enum definition doc-blocks - #86
3.6.2
  • Fix issue with enums not callable within enum classes - #82
3.6.1
3.6.0
  • Add assertIsEnumValue() and assertIsEnumLabel() to \Spatie\Enum\Phpunit\EnumAssertions - #80
3.5.1
  • fix \Spatie\Enum\Enum php-doc [@property-read](https://github.com/property-read) annotations - #78
3.5.0
  • add Faker provider to generate random enum instances, values and labels \Spatie\Enum\Faker\FakerEnumProvider - #74
3.4.0
  • Add \Spatie\Enum\Enum::toValues() and \Spatie\Enum\Enum::toLabels() methods - #72
3.3.0
  • Add \Spatie\Enum\Phpunit\EnumAssertions with a default set of assertions - #71
3.2.0
  • Support PHP ^8.0
3.1.2
  • Don't cast value to string when serializing to JSON - #68
3.1.1
  • Throw TypeError if value passed to Enum construct is not string or integer
3.1.0

#64

  • Add missing type-hints and doc-blocks
  • Fix unique values and labels
  • Flag EnumDefinition as internal
3.0.0
  • A complete overhaul of the package, all details are discussed in the PR
2.3.8
  • Fix for static isXyz($value) magic methods tto return false on invalid value - follow up fix to v2.3.3 - #62
2.3.7
  • Fix internal usage of toArray() to allow custom array representations #58
2.3.6
  • Fix the name if it's matched but isn't the same #50
2.3.5
  • Fix for isEqual() and isAny() method doc-tags to accept mixed values
2.3.4
  • Fix for static method call passed to __call within the context of an object
2.3.3
  • Allow passing invalid string values to isEqual() #39
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport