0039-laravel-enums

Community

Use backed enums for safer domain logic

AuthorMrJmpl3
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill helps you avoid brittle string/integer “magic values” in Laravel by using backed enums that remain type-safe, self-documenting, and consistent across models, DTOs, and validation.

Core Features & Use Cases

  • Backed enum modeling (string/int): Define finite option sets like order statuses, payment providers, and queue names with explicit underlying values.
  • Embedded business logic: Attach labels, colors, fees, and capability rules directly to enum cases using match expressions.
  • First-class Laravel integration: Cast enum fields in Eloquent models, use enum properties in DTOs, and validate enum inputs via Laravel’s Enum rule.
  • When to prefer enums vs state machines: Use enums for simple status fields without transition side effects, and state machines for complex transition rules.

Quick Start

Use the 0039-laravel-enums skill to define a backed enum (string or int) for your domain status values, then cast it in your Laravel model and validate incoming requests against it.

Dependency Matrix

Required Modules

None required

Components

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: 0039-laravel-enums
Download link: https://github.com/MrJmpl3/codex_____data_____configuration/archive/main.zip#0039-laravel-enums

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.