Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/softius/cakephp-param-converter
Converts request parameters to objects
https://github.com/softius/cakephp-param-converter
cakephp cakephp-plugin
Last synced: about 1 month ago
JSON representation
Converts request parameters to objects
- Host: GitHub
- URL: https://github.com/softius/cakephp-param-converter
- Owner: softius
- License: mit
- Created: 2019-01-13T16:03:28.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-08-10T17:36:05.000Z (over 1 year ago)
- Last Synced: 2024-04-21T21:32:39.743Z (9 months ago)
- Topics: cakephp, cakephp-plugin
- Language: PHP
- Homepage:
- Size: 92.8 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Param Converter
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](https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html)
## 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
[
'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 [email protected] instead of using the issue tracker.
## Credits
- [Iacovos Constantinou][link-author]
- [All Contributors][link-contributors]## License
The MIT License (MIT). Please see [License File](LICENSE) for more information.
[link-author]: https://github.com/softius
[link-contributors]: ../../contributors