Finally, the support for Php Enums has been added in the PHP version But as enums are new in php, we do not have some helpers to work with that easily. So with this amazing Laravel Enum Pro package, you have pretty more options for working with enums than built-in methods.

enum LevelTypes: int { use \Lazerg\LaravelEnumPro\EnumPro; case VERY_EASY = case EASY = case MEDIUM = case STRONG = }

As you can see, names here VERY_EASY, EASY, MEDIUM, STRONG, VERY_STRONG.

you can use these helper methods: LevelTypes::names(); // Collection: ['VERY_EASY', 'EASY', 'MEDIUM', 'STRONG', 'VERY_STRONG'] LevelTypes::namesToArray(); // Array: ['VERY_EASY', 'EASY', 'MEDIUM', 'STRONG', 'VERY_STRONG'] LevelTypes::namesToString(); // String: VERY_EASY, EASY, MEDIUM, STRONG, VERY_STRONG
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners