Library to validate input data(method,payload,headers)
Run command
composer require wirwolf/yii2-request-validator
composer update
Or add
"wirwolf/yii2-request-validator": "*"
to the require section of your composer.json
file.
In any controller add behavior requestValidator.
Example:
public function behaviors()
{
return [
'requestValidator' => [
'class' => ActionValidator::className(),
'actions' => [
'index' => [
'get' => [
'headers' => false,
'fields' => [
'key' => '',
'recursiveKey' => ['key']
],
]
],
],
]
];
}
Bugfix: remote any value from fields
Add: field type validator. IsRequired, field type(\yii\validators) and default value
Add: Functional tests