tourze/easy-admin-enum-field-bundle
Adds PHP enum support to EasyAdmin, automatically rendering backed enums as select fields, filters, and display values in CRUD forms so enum-backed entities need little to no manual configuration.
composer require tourze/easy-admin-enum-field-bundle:^1.0.0. The -bundle suffix and easy-admin namespace mean this is built around EasyAdmin (a Symfony bundle), not a native Laravel package — plan for that mismatch before writing code (see Gotchas).src/*Field.php (the field type you’ll actually wire up), src/DependencyInjection/ (how the bundle registers services), then src/Resources/ (form themes / templates, if any). The repository has no README-level documentation for 1.0.0, so source is your spec.enum Status: string {
case Draft = 'draft';
case Published = 'published';
}
and wire it into an admin form field so the enum cases become the selectable options, and rendered values in list/detail views resolve to a human label instead of the raw draft string.enum cast + a Rule::enum() validator yourself.Status::class) and let the bundle derive choices from cases(). This keeps choice lists in sync as you add enum cases — the main reason to use the bundle over hand-written ['draft' => 'Draft', ...] arrays.string/int backed enums as the field’s value type so form submits map cleanly to ::from(). Pure enums are fine for radio/filter widgets but require explicit mapping back to storage.draft in the list is the most common complaint in bundles of this shape — verify each surface after wiring.label(): string) so translation and labels travel with the enum and remain reusable outside EasyAdmin. Fall back to title-casing the case name only for quick prototypes.translator, put keys like enum.status.draft in your translation catalogue; do not hardcode English in admin YAML.required, help, empty_data) rather than fighting the enum field — treat it as a normal ChoiceType-like field for everything except the choice source.ServiceProvider in a -bundle package. A Laravel developer can only “leverage it day-to-day” if the host application runs Tourze/EasyAdmin. Budget time for an adapter layer or choose a native Laravel equivalent./commits/1.0.0) — no migration notes, no BC statement. Treat 1.0.0 as “initial public shape” and pin the exact version in composer.json (1.0.0, not ^1.0) until you’ve diffed 1.0.1 yourself. Read the source at the pinned tag; don’t trust docs that may not exist.null/empty choice is not a case. Confirm how the field handles empty_data and null on submit — otherwise you’ll get ValueError: "" is not a valid backing value from Enum::from() instead of a validation message.(string) on an enum instance or skipping the formatter. Check whether it expects a backed value or the case object and adjust your entity getter/type cast accordingly.case IN_PROGRESS) produce ugly auto-labels and translation keys — override labels explicitly rather than relying on the default transformer.cases() array; confirm the enum FQCN string passed matches the imported class (namespace typos silently yield an empty field in some implementations); check the form theme is loaded if options render unstyled.How can I help you explore Laravel packages today?