Processing incoming values according to your rules. Now I have made 3 mechanisms:
- Clean up spaces
- Cleaning numbers from extraneous characters
- Format string to lower case
You can easily add your own rules!
You can install the package via composer:
composer require mosdev-pro/sanitizer
You can publish the config file with:
php artisan vendor:publish --tag="sanitizer-config"
This is the contents of the published config file:
return [
'rules' => [
'custom' => '' // Your custom Pipeline
]
];
use Mosdev\Sanitizer\Traits\Sanitizer;
class Request extends FormRequest
{
use Sanitizer;
/**
* List of fields and methods for their processing.
*
* @return array
*/
public array $sanitize = [
'user_id' => ['numeric'],
'type' => ['trim', 'lower'],
'text' => ['trim'],
];
}
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.