CakePHP v3.x plugin for converting request parameters to objects. These objects replace the original parameters before dispatching the controller action and hence they can be injected as controller method arguments.
Heavily inspired by Symfony ParamConverter
Using Composer:
composer require softius/cakephp-param-converter
You then need to load the plugin. You can use the shell command:
bin/cake plugin load ParamConverter
Adjustments on application level are only necessary if you need to remove or / add new param converters.
By default, the plugin provides and registers converters that can be used to convert request parameters to Entity and DateTime instances as well as various scalar types. Converters can be removed / added by adjusting the following configuration:
<?php
// config/param_converter.php
return [
'ParamConverter' => [
'converters' => [
\ParamConverter\EntityParamConverter::class,
\ParamConverter\DateTimeParamConverter::class,
\ParamConverter\BooleanParamConverter::class,
\ParamConverter\IntegerParamConverter::class,
\ParamConverter\FloatParamConverter::class
]
]
];
All converters must implement the ParamConverterInterface
.
If you discover any security related issues, please email softius@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.