Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Enum Property Bundle

Enum Property Bundle Laravel Package

adrenalinkin/enum-property-bundle

Symfony bundle integrating EnumMapper: adds Twig filters/functions to convert enum DB values to human labels and back, fetch full enum maps, and provides validation support for enum properties. Install via Composer and enable the bundle in AppKernel.

View on GitHub
Deep Wiki
Context7

Provides integration EnumMapper component with Symfony

Frequently asked questions about Enum Property Bundle
Can I use this bundle directly in Laravel without Symfony?
No, this bundle is designed for Symfony and requires its Kernel, DependencyInjection, and Twig components. You’d need to manually replicate its functionality in Laravel (e.g., register `AbstractEnumMapper` classes as services and create custom Twig/Blade helpers).
How do I convert database enum values to human-readable labels in Laravel?
For Laravel, consider native PHP 8.1 enums or packages like `spatie/laravel-enum` for direct conversion. If using Doctrine, its built-in enum support may suffice. This bundle’s Twig filters won’t work natively without Symfony.
What’s the easiest way to validate enum values in Laravel?
Laravel’s built-in `Validator` facade or `FormRequest` validation rules (e.g., `in:male,female`) are simpler. This bundle’s validator integration is Symfony-specific and requires extra setup for Laravel.
Does this bundle work with Laravel’s Blade templating engine?
No, the bundle provides Twig filters/functions. For Blade, you’d need to create custom directives or use a package like `spatie/laravel-twig` to bridge Twig functionality, adding complexity.
What Laravel versions support this bundle’s underlying EnumMapper?
The `enum-mapper` component is PHP-agnostic and works in Laravel, but the *bundle* itself requires Symfony. For Laravel, use `enum-mapper` directly (PHP 7.4+) or leverage PHP 8.1’s native enums.
Are there Laravel alternatives to this bundle for enum handling?
Yes: `spatie/laravel-enum` (Blade/Twig support), `myclabs/php-enum` (PHP 5.6+), or native PHP 8.1 enums with Doctrine. These avoid Symfony dependencies entirely.
How do I integrate this bundle’s Twig filters in Laravel with Twig?
First install `spatie/laravel-twig`, then manually create a custom Twig extension in Laravel to replicate the bundle’s `enum_to_human`, `enum_to_db`, and `enum_map` logic using `AbstractEnumMapper`.
Will this bundle break if I upgrade Laravel or PHP?
The bundle itself is Symfony-dependent, but the core `enum-mapper` component is stable. Upgrading Laravel/PHP may require adapting the bundle’s Symfony-specific code (e.g., `ContainerInterface` changes).
Can I use this bundle for API responses (e.g., JSON enum labels)?
No, this bundle is template-focused (Twig). For APIs, use Laravel’s `Response` macros, `spatie/laravel-enum`, or PHP 8.1 enums with JSON serialization.
How do I test this bundle in a Laravel project?
Test the underlying `enum-mapper` component directly in Laravel by mocking its `AbstractEnumMapper` classes in PHPUnit. Skip the bundle’s Symfony-specific tests unless you’re building a hybrid Symfony/Laravel setup.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
babenkoivan/elastic-client
innmind/static-analysis
innmind/coding-standard
datacore/hub-sdk
alengo/sulu-http-cache-bundle
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
imbo/imbo-coding-standard
visualbuilder/filament-lottie
servicioslineaonce/starter-kit
atomcoder/laravel-reorderable
irajul/filament-shadcn-theme
agtp/agtp-php
agtp/mod-php
centraldesktop/protobuf-php