laravel-enums
CommunityPowerful, type-safe enums with labels.
Authornextplus896
Version1.0.0
Installs0
System Documentation
What problem does it solve?
Laravel projects often rely on primitive strings or integers to represent finite option sets, which leads to scattered validation rules and inconsistent UI labels. This skill provides backed enums with labels to enforce type safety, coherent validation, and a centralized definition of business constants.
Core Features & Use Cases
- Backed enums with string or integer values for strong typing and compile-time checks.
- UI-friendly labels and traits to expose human-readable names in forms and dropdowns.
- Seamless usage in models (casts to Enum), DTOs, and validation rules, ensuring consistent handling of status or mode fields across the application.
- Guidance on when to use enums vs state machines for complex workflows.
Quick Start
- Create a new Enum in app/Enums with cases representing your domain values, using string backs (e.g., Pending = 'pending').
- Cast model attributes to the enum (e.g., protected $casts = ['status' => OrderStatus::class];).
- Retrieve UI labels via OrderStatus::labels() or $status->getLabel() when using label attributes.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: laravel-enums Download link: https://github.com/nextplus896/durra-alaseel/archive/main.zip#laravel-enums Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.