konekt/enum
SPL inspired PHP enum class implementation
4.2.1
2.5M downloads/mo
#2185 most downloaded on Packagist
artkonekt/enum
What this package is like to depend on
Last release 4 months ago
24 Apr 2026
Release timing varies
gaps range from 2 weeks to 2.1 years
Nearly every release is documented
notes for 21 of 21 stable releases
Nothing withdrawn
no release was ever pulled
10 years old
21 releases · first in 2016
1 release in the last 12 months
see the full history below
Release timeline
21 releases · May 2016 to Apr 2026
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
Releases
latest 21-
4.2.124 Apr 2026Release notes
Open source →2026-04-24
- Added the missing ctype extension dependency to the
composer.json - Tested and works with PHP 8.4 & 8.5
- Added the missing ctype extension dependency to the
-
4.2.029 Feb 2024Release notes
Open source →2024-02-29
- Tested and works with PHP 8.3
- Added the
isAnyOf(),isNoneOf()anddoesNotEqualTo()comparison methods - Added the following methods to the
EnumInterface:equals()doesNotEqualTo()isAnyOf()isNoneOf()
-
4.1.007 Jun 2023Release notes
Open source →2023-06-07
- Added the
EnumInterface(contains most public v4 enum methods); theEnumclass implements it
- Added the
-
4.0.217 Feb 2023 -
4.0.111 Mar 2022Release notes
Open source →2022-03-11
- Improved the details of the error message on unknown value errors
-
4.0.010 Mar 2022Release notes
Open source →2022-03-10
See the complete Upgrade Guide in the Documentation
- Dropped PHP 7.3 and PHP 7.4 support
- BC: Using strict comparison internally everywhere, consequences:
- types are now type sensitive,
- "2" != 2
- null != 0
- if you can do:
YourEnum::create("2")then you can'tYourEnum::create(2)
- Added the feature to create enums that have a null value but the default is not the null one.
- Changed the internals to utilize streamlined PHP 8 features
- Changed the internal implementation to use argument and return types everywhere
- Changed the git attributes so that the test suite, docs and other helper files aren't exported in the vendor folder
3.x
-
3.1.130 Sep 2021Release notes
Open source →2021-09-30
- Fixed magic comparison getter/method in case there were numerical parts in the const name
- Tested and works with PHP 8.1
- Replaced Travis CI with Github Actions
-
3.1.028 Nov 2020Release notes
Open source →2020-11-28
- Dropped PHP 7.1 and 7.2 support
- Added PHP 8 support
- Adopted PSR-12 Coding style (internally)
-
3.0.024 Jun 2019Release notes
Open source →2019-06-24
- The
__defaultconst has been renamed to__DEFAULTfor full PSR-1 compliance. - It is possible to set fallback to default for unknown values.
- Rest of features are equivalent to v2.2.0.
- PHP 7.0 support has been dropped.
- Early PHP 7.4 support (as-is - since it hasn't been released yet).
2.x
- The
-
2.3.025 Jun 2019Release notes
Open source →2019-06-25
- It is possible to set fallback to default for unknown values (Backport from 3.0)
- Tested against early version of PHP 7.4
-
2.2.014 Feb 2019Release notes
Open source →2019-02-14
- The
notEquals()comparison method has been added. - Tested with PHP 7.3 (has been working with earlier versions as well)
- The
-
2.1.109 Jun 2018Release notes
Open source →2018-06-09
- Minor fix: triggering the proper
E_USER_WARNINGerror on unknown method call. - Documentation improved: jump to top when changing page
- Broader PHPUnit support, testing with php 7.2 as well on travis
- Minor fix: triggering the proper
-
2.1.013 Oct 2017Release notes
Open source →2017-10-13 (Friday 🎃)
- Magic checker properties and methods have been added
- Proper documentation has been created (extracted from readme + extended)
-
2.0.226 Sep 2017 -
2.0.114 Sep 2017 -
2.0.013 Sep 2017Release notes
Open source →2017-09-13
- Rewritten from scratch
- API has changed completely, with clarity as primary scope
- Minimum PHP version is 7.0
- Strict mode removed
equals()does type check- For more details refer to Upgrade from v1 to v2
2017-09-06
Development of v2 has been started.
1.x
-
1.2.014 Dec 2016 -
1.1.006 Jul 2016Release notes
Open source →2016-07-06
- Support for display texts has been added
- BC:
__toString()casting now takes display text instead of const values. However the result is the very same in case no display text is being used, since it falls back to the const value if no display text is specified. - Changelog started (added all backwards versions beginning from 1.0.0
-
1.0.231 May 2016 -
1.0.130 May 2016 -
1.0.030 May 2016Release notes
Open source →2016-05-30
- Initial release based on konekt/comon v0.1.2, heavily refactored version