Backed enums with labels and business logic. Use when working with enums, status values, fixed sets of options, or when user mentions enums, backed enums, enum cases, status enums.
/plugin marketplace add leeovery/claude-laravel/plugin install leeovery-claude-laravel@leeovery/claude-laravelThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Enums provide type-safe, finite sets of values.
Related guides:
Always use backed enums (string or int):
<?php
declare(strict_types=1);
namespace App\Enums;
enum OrderStatus: string
{
case Pending = 'pending';
case Processing = 'processing';
case Completed = 'completed';
case Cancelled = 'cancelled';
}
Add functionality with traits:
<?php
declare(strict_types=1);
namespace App\Enums;
use Henzeb\Enumhancer\Concerns\Comparison;
use Henzeb\Enumhancer\Concerns\Dropdown;
enum OrderStatus: string
{
use Comparison, Dropdown;
case Pending = 'pending';
case Processing = 'processing';
case Completed = 'completed';
case Cancelled = 'cancelled';
}
<?php
declare(strict_types=1);
namespace App\Enums;
use App\Enums\Attributes\Label;
use App\Enums\Concerns\HasLabel;
enum PaymentMethod: string
{
use HasLabel;
#[Label('Credit Card')]
case CreditCard = 'credit-card';
#[Label('Bank Transfer')]
case BankTransfer = 'bank-transfer';
#[Label('PayPal')]
case PayPal = 'paypal';
}
<?php
declare(strict_types=1);
namespace App\Enums\Attributes;
use Attribute;
#[Attribute(Attribute::TARGET_CLASS_CONSTANT)]
class Label
{
public function __construct(public string $value) {}
}
#[Attribute(Attribute::TARGET_CLASS_CONSTANT)]
class Color
{
public function __construct(public string $value) {}
}
#[Attribute(Attribute::TARGET_CLASS_CONSTANT)]
class Icon
{
public function __construct(public string $value) {}
}
<?php
declare(strict_types=1);
namespace App\Enums\Concerns;
use App\Enums\Attributes\Label;
use Henzeb\Enumhancer\Concerns\Attributes;
use Henzeb\Enumhancer\Concerns\Dropdown;
use Henzeb\Enumhancer\Concerns\Labels;
trait HasLabel
{
use Attributes, Dropdown, Labels;
public static function labels(): array
{
return collect(self::cases())->mapWithKeys(fn ($enum) => [
$enum->name => $enum->getLabel(),
])->toArray();
}
public function getLabel(): ?string
{
return $this->getAttribute(Label::class)?->value;
}
}
Enums can contain behavior:
enum PaymentProvider: string
{
case Stripe = 'stripe';
case PayPal = 'paypal';
case Square = 'square';
public function processingFee(int $amount): int
{
return match ($this) {
self::Stripe => (int) ($amount * 0.029 + 30),
self::PayPal => (int) ($amount * 0.034 + 30),
self::Square => (int) ($amount * 0.026 + 10),
};
}
public function supportsRefunds(): bool
{
return match ($this) {
self::Stripe, self::PayPal => true,
self::Square => false,
};
}
}
protected function casts(): array
{
return [
'status' => OrderStatus::class,
'payment_method' => PaymentMethod::class,
];
}
public function __construct(
public OrderStatus $status,
public PaymentMethod $paymentMethod,
) {}
use Illuminate\Validation\Rules\Enum;
'status' => [
'required',
'string',
'bail',
new Enum(OrderStatus::class),
],
if ($order->status->is(OrderStatus::Completed)) {
// ...
}
// With enumhancer Comparison trait
if ($order->status->isCompleted()) {
// ...
}
$status->getLabel(); // 'Completed'
PaymentMethod::dropdown(); // For select inputs
OrderStatus::labels(); // All labels as array
$message = match ($order->status) {
OrderStatus::Pending => 'Your order is pending',
OrderStatus::Processing => 'We are processing your order',
OrderStatus::Completed => 'Your order is complete',
OrderStatus::Cancelled => 'Your order was cancelled',
};
<?php
declare(strict_types=1);
namespace App\Enums;
enum Queue: string
{
case Default = 'default';
case Processing = 'processing';
case Emails = 'emails';
case Notifications = 'notifications';
}
Usage in jobs:
public function __construct(public Order $order)
{
$this->onQueue(Queue::Emails->value);
}
app/Enums/
├── OrderStatus.php
├── PaymentMethod.php
├── Queue.php
├── Attributes/
│ ├── Label.php
│ ├── Color.php
│ └── Icon.php
└── Concerns/
└── HasLabel.php
Use Enums:
Use State Machines:
See State Machines for state machines.
Enums provide:
Always use backed enums with string or int values.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.