Weave Code
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

Enum Laravel Package

konekt/enum

Lightweight PHP enum base class (pre-PHP 8.1) for defining value-safe constants via abstract Enum subclasses. Simple instantiation, validation and utilities, with docs and optional Laravel Eloquent integration via konekt/enum-eloquent.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Enables consistent enum usage in legacy PHP applications (pre-8.1), reducing bugs from invalid string values and improving code readability.
  • Supports roadmap planning for teams needing enum patterns before upgrading to PHP 8.1+, with a clear migration path to native enums in v5.0.
  • Eliminates "build vs buy" tradeoffs for enum implementation—proven, lightweight solution vs reinventing error-prone custom logic.
  • Use cases include order statuses, payment methods, and user roles where strict value sets are required, with built-in label support for UI display.

When to Consider This Package

  • ✅ Adopt when: targeting PHP <8.1, needing type-safe enums for domain values, or maintaining legacy Laravel apps where native enums aren't available.
  • ✅ Adopt when: requiring nullable enums (e.g., optional gender fields) or label-based display texts for UI components.
  • ❌ Look elsewhere when: using PHP 8.1+ (native enums are simpler and more performant), or for new projects where upgrading PHP is feasible.
  • ❌ Avoid if: the team prefers minimal dependencies (though this package is lightweight) or if the project has strict PHP 8.1+ requirements.

How to Pitch It (Stakeholders)

  • Executives: "This package reduces bugs and maintenance costs by enforcing valid values for critical business states (e.g., order statuses), saving engineering time on manual validation. It’s a proven, MIT-licensed solution that integrates seamlessly with Laravel and will smoothly transition to PHP 8.1+ native enums in the future."
  • Engineering: "It provides a battle-tested enum implementation with Laravel Eloquent integration via a trait, supporting labels for UIs, nullable values, and easy migration. The documentation is thorough, and the codebase is stable—ideal for legacy systems where upgrading PHP isn’t immediate."
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.
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament