ex3v / myclabs-enum-param-converter
Package info
github.com/Ex3v/MyCLabsEnumParamConverter
Type:symfony-bundle
pkg:composer/ex3v/myclabs-enum-param-converter
dev-master / 0.0.1.x-dev
2019-05-15 15:14 UTC
Requires
- php: ^7.0
- myclabs/php-enum: ^1.2
- sensio/framework-extra-bundle: ^3.0|^4.0|^5.0
Requires (Dev)
- phpunit/phpunit: ^5.4|^6.0
- symfony/phpunit-bridge: ~2.7
This package is auto-updated.
Last update: 2026-03-16 06:35:17 UTC
README
A simple Symfony bundle to enable seamless MyClabs\Enum param conversion in your controllers.
Installation and usage
1. Install via composer:
composer require ex3v/myclabs-enum-param-converter
2. Enable bundle:
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new \Ex3v\MyCLabsEnumParamConverterBundle\MyCLabsEnumParamConverterBundle(), ); }
3. Use in your controller:
/** * @ParamConverter("barType") */ public function fooAction(BarType $barType) : Response { //... }
Note that you do not have to point out specific converter as long as you use typehints in your controller actions.
If you want to point out this converter explicitly, use following example:
/** * @ParamConverter("barType", converter="converter_enum") */ public function fooAction(BarType $barType) : Response { //... }