laranail / enumerator
The integration-rich Laravel enum toolkit — attributes, state machines, bitmasks, validation, casts, Blade components, and Filament / Livewire / Nova / Inertia integrations. PHP 8.3+, Laravel 13+.
Requires
- php: ^8.3
- illuminate/console: ^13.0
- illuminate/contracts: ^13.0
- illuminate/database: ^13.0
- illuminate/support: ^13.0
- illuminate/validation: ^13.0
- illuminate/view: ^13.0
Requires (Dev)
- infection/infection: ^0.29
- larastan/larastan: ^3.0
- laravel/pint: ^1.18
- livewire/livewire: ^3.5
- orchestra/testbench: ^10.0|^11.0
- pestphp/pest: ^3.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.0
Suggests
- filament/filament: Use the Filament integration (columns, form fields, filters).
- inertiajs/inertia-laravel: Use the Inertia transformer for typed SPA responses.
- laravel/nova: Use the Nova integration (field, filter).
- laravel/octane: Use the Octane module (Modules/Octane) for per-worker reflection-cache warmup.
- livewire/livewire: Use the Livewire enum-aware property casts and rule helpers.
- nuwave/lighthouse: Use the Lighthouse module (Modules/Lighthouse) for GraphQL scalar registration.
- rector/rector: Use the Rector migration rules (src/Rector/) to migrate from BenSampo/Spatie enums to laranail/enumerator.
- saloonphp/saloon: Use the Saloon module (Modules/Saloon) to serialize enum instances in API request payloads.
README
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.
Install
composer require laranail/enumerator
The service provider is auto-discovered. One trait — use HasEnumerator; — composes labels, comparisons, bitmasks, grouping, lifecycle, transitions, and factories.
Documentation
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.
Contributing & security
Issues and PRs are welcome — see CONTRIBUTING.md. Report vulnerabilities per SECURITY.md (opensource@simtabi.com); participation follows the Code of Conduct.
License
MIT © Simtabi LLC. See LICENSE.