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 Easy Enum

Laravel Easy Enum Laravel Package

sakanjo/laravel-easy-enum

Simplify PHP enums in Laravel with sakanjo/laravel-easy-enum. This lightweight package provides helpers for labels, values, options, validation rules, and Eloquent/Blade integration, reducing boilerplate and keeping enum-driven code clean and readable.

View on GitHub
Deep Wiki
Context7

Easily work with enums.

Frequently asked questions about Laravel Easy Enum
What is sakanjo/laravel-easy-enum used for in Laravel?
It is a lightweight helper package for working with PHP enums in Laravel. It provides conveniences for enum labels, values, options, validation rules, and Eloquent/Blade integration, reducing boilerplate around status, type, and workflow-state fields. It is a developer-productivity layer, not a replacement for native PHP enums or Laravel's core casting system.
How do I install sakanjo/laravel-easy-enum?
Install it through Composer using the package name and follow the repository README for any Laravel service-provider or configuration steps. Because Laravel package auto-discovery may or may not apply, check the README and composer.json before assuming zero setup. After installation, pilot it on one enum and confirm labels, options, validation, and serialization behave as expected.
Which Laravel and PHP versions does this enum package support?
The provided context does not specify exact Laravel and PHP version constraints, so verify composer.json, the README, and any CI matrix before adopting it. It is designed for Laravel projects using native PHP enums, most likely PHP 8.1+ backed enums. Confirm support for your Laravel LTS or current release rather than relying on assumptions.
Can it generate validation rules from an enum?
The package advertises validation-rule helpers as part of its enum convenience layer. That can reduce hand-written in:... rules or custom Rule objects for enum-backed fields. Test invalid values, nullable fields, and API error responses in your app because exact rule behavior should be confirmed against the package source.
Does sakanjo/laravel-easy-enum work with Eloquent casts?
The package is positioned for Eloquent integration alongside native enum handling. It should be treated as additive convenience around Laravel's enum casting rather than a reason to change database columns or core model behavior. Spike it on one model and verify casts, query scopes, and serialized API output before wider use.
How does Blade integration help with enum options?
Blade integration is intended to make enum values, labels, or option lists easier to render in forms and views. That can cut repetitive @foreach blocks and label mapping for select inputs. Confirm escaping, localization, and selected-state handling in your own Blade components before standardizing on it.
Is this package suitable for production Laravel applications?
It can be suitable for bounded, non-critical use cases if you isolate it behind an internal adapter and cover enum behavior with application tests. The package has low adoption and a single-maintainer profile, so treat maturity, release history, and backward-compatibility discipline as risks. Pilot it first rather than making it a foundational dependency across all services.
Can I adopt it incrementally without rewriting existing enums?
Incremental adoption appears feasible because the package is a convenience layer rather than a platform dependency. Inventory existing enum casts, validation rules, labels, and serializers, then introduce helpers in one bounded context behind a local trait or adapter. Run it alongside current behavior and compare validation failures and API payloads before expanding.
What are alternatives to sakanjo/laravel-easy-enum?
Alternatives include native Laravel enum casts and validation rules, hand-written label/options methods on enums, or an internal enum utility package. Some teams also use broader enum helper packages or static analysis-friendly enum libraries. Choose based on supported Laravel versions, maintenance activity, test coverage, and whether you need labels, validation, Blade, and Eloquent helpers together.
How should I evaluate maintenance and static analysis support?
Review the repository's release history, issue responsiveness, CI configuration, and documented backward-compatibility policy before adopting it. Check that enum helper methods are discoverable by your IDE and compatible with PHPStan or Psalm at your analysis level. Because adoption is low and the last release date should be verified, keep the package behind an internal abstraction and pin versions in Composer.
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