NewWe open-sourced 50+ Laravel packages
Custom AI apps, agents and automation — Roundly ConsultingRoundly
All packages
Enums for Laravel

Readable labels

readable() turns a case into a human-friendly label: it runs the backed value — or the case name on a pure enum — through Str::headline(), then looks the headline up in Laravel’s translator for the current locale. Without a matching translation the headline itself is returned. label() is an alias for UI code that prefers that name:

NewsCategory::HotNews->readable(); // "Hot News"
NewsCategory::HotNews->label();    // "Hot News"

enum Status { use Helpers; case Active; }

Status::Active->readable(); // "Active"

How values become labels

CaseLabel
case HotNews = 'hot-news'Hot News
case OnHold = 'on_hold'On Hold
case InProgress = 'inProgress'In Progress
case Pending = 'pending'Pending
case ActiveActive (pure enum — the name is used)
case Medium = 55 (int-backed — the number itself)

The label is derived from the value, not the case name, so choose values that read well — or translate them. Every other label-based helper — labels(), toOptions(), toArray(), options(), fromLabel() and tryFromLabel() — goes through readable(), so a custom or translated label applies everywhere at once.

Labels come from the application’s translator, so label-producing methods need a booted Laravel app. If a headline happens to name a whole translation group instead of a line — “Auth” matches lang/en/auth.php on a case-insensitive filesystem — the untranslated headline is returned rather than the group.

All labels at once

NewsCategory::labels()->all(); // ['Hot News', 'Regular News', 'Private News']

Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

More ways to support, including crypto

By donating, you agree to our donation terms.

Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.