Download the PHP package palabs/enum-bundle without Composer
On this page you can find all versions of the php package palabs/enum-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package enum-bundle
Symfony bundle for PaLabs/php-enum
Bundle provide integration PaLabs/php-enum with symfony
Features
- Enum form type
- Enum translator (with twig extension)
- Doctrine integration (enum field type, types auto generation)
- Enum auto initializer
Installation
-
Require bundle using composer
-
Add bundle to bundle list (file bundles.php in symfony 5)
- Create configuration (in your config dir). Example:
Usage
Translator
EnumTranslator class provide methods to translate enum values. Example:
Enum form
Class EnumType provide symfony form type for your forms. Example:
Doctrine type
Bundle provide a mechanism for doctrine type generation based on you enums. For example, if you have an entity class:
Bundle will automaticly generate a doctrine type for BookType enum and add it to doctrine types config. You can specify paths where enums will be found:
Enum initializer
To not manually call Enum::init() for every enum, you can use enum initializer. Simply add to bundle config:
And bundle will automatically call init() for every enum in path. init() will be called on bundle boot.
All versions of enum-bundle with dependencies
doctrine/common Version ^2.8 || ^3.0
doctrine/orm Version ^2.8
symfony/form Version ^6.0 || ^7.0
symfony/doctrine-bridge Version ^6.0 || ^7.0
symfony/translation-contracts Version ^2.0
symfony/framework-bundle Version ^6.0 || ^7.0
symfony/dependency-injection Version ^6.0 || ^7.0
symfony/http-kernel Version ^6.0 || ^7.0
twig/twig Version ^3.0