softius / cakephp-param-converter
Param converter for CakePHP Routing
Installs: 29
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 1
Open Issues: 2
Type:cakephp-plugin
Requires
- php: >=7.1
- cakephp/cakephp: ^3.7.0
Requires (Dev)
- qobo/cakephp-composer-dev: ^v1.0
This package is auto-updated.
Last update: 2024-11-07 05:46:49 UTC
README
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
Install
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
Usage
Adjustments on application level are only necessary if you need to remove or / add new param converters.
Configuration
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 ] ] ];
Creating a converter
All converters must implement the ParamConverterInterface
.
Security
If you discover any security related issues, please email softius@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.