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.
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
ecotone/kafka
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata