Weave 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
Laravel Enums

Laravel Enums Laravel Package

nasyrov/laravel-enums

Laravel Enums adds first-class enumeration support: define typed enum classes, then use them as Eloquent casts, validation rules, and translatable labels. Helpers for values, options, and comparisons make model attributes and form choices safer and more expressive.

View on GitHub
Deep Wiki
Context7

Laravel package for Enum implementation.

Frequently asked questions about Laravel Enums
What is nasyrov/laravel-enums used for?
It is a Laravel package that adds enum-like value classes with helpers for values, options, comparisons, Eloquent casts, validation rules, and translatable labels. It was designed for Laravel applications that predate native PHP backed enums. Modern Laravel projects should generally use native PHP enums plus Laravel enum casting and Rule::enum validation.
Does nasyrov/laravel-enums support Laravel 10 and Laravel 11?
Compatibility with Laravel 10 and Laravel 11 must be proven, not assumed. The last release was in December 2020, and the package targets the pre-PHP 8.1 era. Run a Composer dependency spike against your exact PHP and Laravel versions before considering it. For most modern stacks, it is likely to be incompatible or unnecessary.
Can I use laravel-enums with PHP 8.1 native enums?
The package predates native PHP enums, so using it alongside native backed enums adds a redundant abstraction layer. Laravel already supports enum casting and Rule::enum validation natively. Teams standardizing on PHP 8.1+ should avoid introducing this package for new development.
How do I install nasyrov/laravel-enums?
Installation is via Composer with nasyrov/laravel-enums. However, the package has not been released since December 2020, so installation may fail or create conflicts on modern Laravel and PHP versions. Validate the full dependency matrix in a throwaway branch before adding it to a maintained application.
Does laravel-enums support Eloquent model casting?
Yes, the package is designed to let enum classes be used as Eloquent casts for model attributes. That was valuable before Laravel added native enum casting. On modern Laravel versions, native enum casts are the safer and better-supported choice.
How does validation work with laravel-enums?
The package provides enum-oriented validation helpers so form input can be restricted to defined enum values. In current Laravel versions, Rule::enum is the native way to validate backed enums. If you maintain a legacy usage, test validation behavior carefully across framework upgrades.
Does laravel-enums support translatable labels?
Yes, the package includes translatable labels and option helpers intended for form choices and display values. Localization behavior may depend on older Laravel conventions and should be verified against your target framework version. Modern applications can implement labels with native enums and Laravel translation helpers.
Is nasyrov/laravel-enums actively maintained?
No. The last release was in December 2020, adoption is low at around 32 stars, and the technical assessment score is 0.43. Treat it as effectively unmaintained and plan for containment, vendoring, forking, or replacement rather than assuming upstream fixes. Any fork becomes an owned dependency with its own support burden.
What are the best alternatives to laravel-enums?
For modern Laravel applications, the best alternative is native PHP backed enums combined with Laravel enum casting and Rule::enum validation. These are platform-supported, well documented, and avoid an extra package dependency. If you need labels or options, small application-level helper methods can cover that without a legacy package.
How do I migrate from laravel-enums to native PHP enums?
Inventory every enum class, Eloquent cast, validation rule, database mapping, serialization boundary, and localization usage. Map each package enum to a native backed enum, introduce adapters or compatibility shims where needed, and migrate call sites incrementally. Test casting, validation, JSON serialization, queues, and database round-trips before removing the package.
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.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections