- How do I install lazerg/laravel-enum-pro?
- Install it with Composer using composer require lazerg/laravel-enum-pro. The package is a single-namespace, Composer-installable convenience layer over PHP 8.1+ backed enums, so integration is usually quick. Check the composer.json constraints first to confirm the Laravel and PHP versions your app uses are allowed.
- Which Laravel and PHP versions does Laravel Enum Pro support?
- The package targets Laravel applications on PHP 8.1+ and is described as fitting Laravel 9, 10, and 11 codebases that already use native backed enums. Because it is a low-volume package, verify the illuminate/support constraint in composer.json before a framework upgrade. If the constraint lags, you may need to wait, patch, or fork.
- Does Laravel Enum Pro replace native PHP enums?
- No. Laravel Enum Pro is additive sugar over native PHP backed enums, not a replacement type. It adds helpers such as label(), values(), options(), and toArray() while keeping enums idiomatic for Eloquent casts, validation, form requests, API resources, and factories. The main architectural caution is not letting package-specific helpers leak into domain logic as an uncontrolled contract.
- How does Laravel Enum Pro work with Eloquent casts?
- Eloquent casting is one of the advertised affordances, and the underlying native backed enum remains compatible with Laravel's enum casting. Use the package helpers for presentation and keep casts and persistence behavior covered by tests. Confirm how values are stored and serialized before relying on them in existing data.
- Can I use Laravel Enum Pro for enum validation rules in form requests?
- Yes, validation rules are a core feature, alongside Laravel's native Rule::enum support. You can use them in form requests and other validation paths to keep enum inputs consistent. Test the rule behavior with your specific enum cases and any localized labels you expose.
- How do labels, descriptions, and localization work in Laravel Enum Pro?
- label() and description() provide human-friendly enum output, and the package advertises localization support for display strings. Those derivations become an API contract if you serialize them into JSON or store them in the database. Decide early how labels map from case names and how ordering works, because changing it later can be a data migration.
- How can I build select options from a PHP enum in Laravel?
- options() and toArray()/values() are intended to build select options and simple payloads from enum cases. That cuts boilerplate in Blade forms, APIs, and Inertia-style payloads. Treat option ordering and label text as public behavior once they reach clients.
- Is Laravel Enum Pro maintained and safe for production?
- Treat it as a small, single-maintainer dependency: community signals are weak at roughly 43 stars and a 0.375 composite score, which is a legitimate abandonment-risk flag. The code is described as small enough to vendor or fork in an afternoon. Pin the version, check open issues and PRs, verify PHPStan/Psalm baselines and CI coverage, and have an exit plan before org-wide standardization.
- What are alternatives to Laravel Enum Pro?
- The strongest alternative is native PHP backed enums plus a local trait that provides the toArray(), label(), and options() helpers you actually need. A 30-minute spike comparing the package API with an approximately 80-line trait is the decisive test. For legacy code, myclabs/php-enum exists, but mixing that idiom with native enums without a deliberate migration is worse than choosing one.
- Is Laravel Enum Pro framework-agnostic or tied to illuminate/support?
- The key dependency question is whether it requires illuminate/support; if it is framework-coupled, using it outside Laravel is limited. It is also a poor fit for codebases still on myclabs/php-enum or class-constant enum patterns unless you deliberately migrate. Check composer.json and run a small compatibility test before adopting it broadly.