php-enum
The enum PHP is missing, inspired from SplEnum (by myclabs)
enum
Strongly typed enums in PHP supporting autocompletion and refactoring (by spatie)
php-enum | enum | |
---|---|---|
2 | 2 | |
2,714 | 748 | |
0.2% | 2.0% | |
3.2 | 3.2 | |
3 months ago | 17 days ago | |
PHP | PHP | |
MIT License | MIT License |
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
php-enum
Posts with mentions or reviews of php-enum.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2021-08-17.
-
Weekly "ask anything" thread
My understanding of the new PHP enums are that they provide a first-class citizen for enum patterns in userland that are extremely common. For example, there is a popular enum library https://github.com/myclabs/php-enum. But many people craft these by hand in their projects. The main idea is to provide an abstraction over "strings that inform business logic" for lack of a better term.
-
My opinion on the PHP 8.1 Enum RFC
This feature alone would likely cause me to drop myclabs/php-enum as my enum implementation.
enum
Posts with mentions or reviews of enum.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2022-09-25.
-
Safely upgrade from PHP 7.4 to 8.1 using Rector
That last rule SpatieEnumClassToEnumRector is skipped because I'm using the spatie/enum package, and I don't want it to be converted to PHP native enums automatically. The reason for that is that the Spatie package has some nice little helpers, and it's safer in my opinion to migrate some of the enums manually.
-
Laravel 9: Enums!
And yes! Finally we have official support for Enums in php 8.1 although we could add them to Laravel framework by using third-party packages like spatie/enums.
What are some alternatives?
When comparing php-enum and enum you can also consider the following projects:
php-enum - Simple and fast implementation of enumerations with native PHP
laravel-enum - Simple, extensible and powerful enumeration implementation for Laravel.
attributary - A library for PHP 8 Attribute developers. This library gives developers a similar experience to the Doctrine/Annotation library.
Laravel - Laravel is a web application framework with expressive, elegant syntax. We’ve already laid the foundation for your next big idea — freeing you to create without sweating the small things.
DoctrineEnumBundle - 📦 Provides support of ENUM type for Doctrine in Symfony applications.
Laravel - The Laravel Framework.