NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist · #616 most downloaded on Packagist
PHP Enums
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
Implement Stringable interface on Enum by @jdecool in #116
Add support for isset() calls to enum ->value und ->label - #109
One column per quarter.
isset() calls to enum ->value und ->label - #109Change attribute for PHP 8.1 compatibility
Added support for PHP 8.1
Fix from() and tryFrom() methods to do PHP type-juggling (string to integer) - #108
Deprecate make() in favor of from() method - #94
Add cases() method to retrieve all instances of the enum - #79
cases() method to retrieve all instances of the enum - #79Fix problem with @readonly annotation and annotation parsing libraries - #92
@readonly annotation and annotation parsing libraries - #92Add description to PHPUnit assertion methods - #88
Add ability to use a Closure as value/label map - #87
Closure as value/label map - #87Add psalm annotations to seal and lock internals - #85
Fix extra whitespaces in enum definition doc-blocks - #86
Fix issue with enums not callable within enum classes - #82
Nothing published for this version
Add assertIsEnumValue() and assertIsEnumLabel() to \Spatie\Enum\Phpunit\EnumAssertions - #80
assertIsEnumValue() and assertIsEnumLabel() to \Spatie\Enum\Phpunit\EnumAssertions - #80Fix \Spatie\Enum\Enum php-doc @property-read annotations - #78
\Spatie\Enum\Enum php-doc @property-read annotations - #78Add Faker provider to generate random enum instances, values and labels \Spatie\Enum\Faker\FakerEnumProvider - #74
Add \Spatie\Enum\Enum::toValues() and \Spatie\Enum\Enum::toLabels() methods - #72
\Spatie\Enum\Enum::toValues() and \Spatie\Enum\Enum::toLabels() methods - #72Add \Spatie\Enum\Phpunit\EnumAssertions with a default set of assertions - #71
\Spatie\Enum\Phpunit\EnumAssertions with a default set of assertions - #71- Support PHP ^8.0
Don't cast value to string when serializing to JSON - #68
Throw TypeError if value passed to Enum construct is not string or integer
TypeError if value passed to Enum construct is not string or integerAdd missing type-hints and doc-blocks
EnumDefinition as internalA complete overhaul of the package, all details are discussed in the PR
Fix for static isXyz($value) magic methods tto return false on invalid value - follow up fix to v2.3.3 - #62
Fix internal usage of toArray() to allow custom array representations #58
toArray() to allow custom array representations #58Fix the name if it's matched but isn't the same #50
Fix for isEqual() and isAny() method doc-tags to accept mixed values
isEqual() and isAny() method doc-tags to accept mixed valuesFix for static method call passed to __call within the context of an object
__call within the context of an objectAllow passing invalid string values to isEqual() #39
isEqual() #39Nothing published for this version
Fix protected method calls to allow overrides #37
protected method calls to allow overrides #37Make \Spatie\Enum\Enumerable::isValidIndex/Name/Value() methods public #36
\Spatie\Enum\Enumerable::isValidIndex/Name/Value() methods public #36Please note that this could be breaking for custom implementations of the
\Spatie\Enum\Enumerableinterface.
Add \Spatie\Enum\Enum::getAll() method #33
\Spatie\Enum\Enum::getAll() method #33Fix calling public non-static methods #32
Fix overriden existing public static methods like Enum::toArray() #29
Enum::toArray() #29Add enum map index and value Enum::MAP_INDEX and Enum::MAP_VALUE #25
Enum::MAP_INDEX and Enum::MAP_VALUE #25Improved static analysis support for ::make
::makeA 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.
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.
\Spatie\Enum\Enumerable interface\Spatie\Enum\Exceptions\DuplicatedIndexException, \Spatie\Enum\Exceptions\DuplicatedValueException, \Spatie\Enum\Exceptions\InvalidIndexException and \Spatie\Enum\Exceptions\InvalidValueException exceptions\Spatie\Enum\Enum->getIndex() method\Spatie\Enum\Enum::getIndices() method\Spatie\Enum\Enum->getValue() method\Spatie\Enum\Enum::getValues() method\Spatie\Enum\Enum::from() to \Spatie\Enum\Enum::make()\Spatie\Enum\Enum::equals() to \Spatie\Enum\Enum::isEqual()\Spatie\Enum\Enum::isOneOf() to \Spatie\Enum\Enum::isAny()\Spatie\Enum\Enum->__construct() signature and responsibility - only take index & value and validate them\Spatie\Enum\Enum::toArray() return value instead of an array of value => name it returns value => index\Spatie\Enum\Enum::make() support from inside of an unstatic method\Spatie\Enum\Enum::$map in favor of \Spatie\Enum\Enum->getIndex()and \Spatie\Enum\Enum->getValue()index: int and value: string- Add support for is\* checks
Support case insensitive enum values
Nothing published for this version
- initial release
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →