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 Enumeration Laravel Package

sourceboat/laravel-enumeration

A Laravel package for defining and using enumerations in PHP, with support for validation rules, model casting, and comparing enum values in a clean, type-safe way across your application.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Domain modeling of finite states. Justifies treating order status, subscription lifecycle, payment state, ticket priority, roles, and notification channels as typed domain concepts rather than free-form strings — a decision that shapes database columns, API contracts, and validation rules.
  • Data integrity investment. Informs whether the team spends effort on compile-time/validation-time guarantees against invalid states, and how much of the "impossible states" problem is solved in code versus left to database constraints and code review.
  • Build vs. buy for internal plumbing. A PM decision on whether to hand-roll a base enum class (labels, colors, option lists, comparison helpers, Eloquent casting) or adopt a small package. The scope here is narrow and well-bounded, so the cost of either path is low.
  • Framework-version roadmap. Native PHP 8.1 backed enums plus Laravel's enum casting and Rule::enum validation now cover much of this package's surface area. This is a direct input into upgrade sequencing: migrating to modern PHP may retire the dependency entirely.
  • API and UI consistency. Standardized label(), color(), and options() helpers reduce duplicate presentation logic across admin panels, exports, and client payloads — a lever on both consistency bugs and delivery speed for CRUD-heavy features.
  • Test and onboarding ergonomics. Named enum cases make tests and feature specs readable (OrderStatus::Shipped vs. 'shipped'), which affects onboarding time and defect rates in workflow-heavy modules.

When to Consider This Package

Consider it when:

  • The codebase runs on a PHP version below 8.1 or a Laravel version below the enum-casting support line, so native backed enums are not an option.
  • The team has already standardized on the eloquent/enumeration value-object pattern, and this package is a thin, compatible extension of that convention.
  • You need behavior attached to cases — human-readable labels, UI colors, ordered comparisons, option arrays for select inputs, and Eloquent attribute casting — in one place rather than scattered helpers.
  • You are willing to vendor or fork it. With zero stars and zero dependents, treat it as source code you own, not a maintained upstream dependency.

Look elsewhere when:

  • You are greenfield on PHP 8.1+ and Laravel 10+. Native backed enums, casts, and Rule::enum cover the majority of the use case with no third-party surface area.
  • You need richer attribute metadata, translations, or active maintenance — spatie/laravel-enum or BenSampo/laravel-enum have materially larger communities and release cadence.
  • Procurement, security review, or support SLAs apply. Zero adoption signals mean no CVE response history, no issue-tracker triage, and no bus factor beyond a single maintainer.
  • The enum values are purely internal and never surface in APIs or UI; the abstraction cost exceeds the payoff.

How to Pitch It (Stakeholders)

For executives: This is a small, low-cost utility that makes finite business states — order status, subscription lifecycle, payment outcomes — explicit in code instead of loose strings. The business payoff is fewer production defects from invalid or misspelled states and more consistent labels across admin tools, exports, and customer-facing surfaces. The cost is negligible and the replacement cost is equally negligible, so it is a low-risk, reversible decision. The main caveat is that the package has essentially no adoption or maintenance signal, so it should be treated as code we own rather than a supported vendor dependency — and on modern PHP it is largely superseded by language-level enums.

For engineering: Evaluate it as a convenience layer over eloquent/enumeration, not as a strategic dependency. Recommended path: pilot it in a single bounded domain (e.g., order status) behind a thin internal interface, confirm the label/options/casting ergonomics actually beat native backed enums in our code, and record the migration path to native enums if we later drop it. Absent a strong ergonomic win on a pre-8.1 codebase, prefer native enums plus Laravel casting and validation — fewer moving parts, no fork obligation, no supply-chain review.

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.
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings