laranail/enumerator is not published to Packagist, so there is no registry-version badge to show: see Install.
The integration-rich Laravel enum toolkit — native enums with declarative attributes, state machines, bitmasks, Blade components, Eloquent casts, validation rules, Filament/Nova/Livewire/Inertia integrations, optional Pest/OpenAPI/GraphQL modules, per-tenant overrides, and Rector migration codemods.
PHP ^8.3 on Laravel ^13.
composer require laranail/enumeratorThe service provider is auto-discovered. One trait — use HasEnumerator; — composes labels, comparisons, bitmasks, grouping, lifecycle, transitions, and factories.
Nothing to configure: the service provider registers itself through package discovery, and an enum needs only the trait. Optional steps, each for one feature:
# Scaffold an enum into App\Enums
php artisan laranail::enumerator.make UserStatusEnum
# The state-history table, only if you record transitions
php artisan vendor:publish --tag=laranail::enumerator-migrations
php artisan migrateENUMERATOR_CSS picks the Blade components' CSS framework (plain by default).
use Simtabi\Laranail\Enumerator\Concerns\HasEnumeratorBehavior;
use Simtabi\Laranail\Enumerator\Contracts\Enumerator;
enum UserStatusEnum: string implements Enumerator
{
use HasEnumeratorBehavior;
case Active = 'active';
case Inactive = 'inactive';
case Banned = 'banned';
}
UserStatusEnum::Active->label(); // "Active"
UserStatusEnum::Active->is('active'); // true
UserStatusEnum::options(); // ['active' => 'Active', 'inactive' => 'Inactive', 'banned' => 'Banned']use Simtabi\Laranail\Enumerator\Casts\AsEnum;
protected function casts(): array
{
return ['status' => AsEnum::of(UserStatusEnum::class)]; // null-aware + name lookup
}<x-laranail-enumerator::badge :case="$user->status" />The full walkthrough is in Getting started; everything else is in the documentation index.
Full documentation is at opensource.simtabi.com/documentation/laranail/enumerator — getting started, the attribute metadata system, the consumer-side HasEnumAttributes trait, Eloquent, validation, Blade, state machines, bitmasks, translations, per-tenant overrides, database-backed dynamic enums, the optional integration modules, Artisan commands, TypeScript export, and migrating from BenSampo/Spatie enums.
Issues and PRs are welcome — see CONTRIBUTING.md. Report vulnerabilities per SECURITY.md (opensource@simtabi.com); participation follows the Code of Conduct.
MIT © Simtabi LLC. See LICENSE.