wirwolf / yii2-request-validator
Installs: 2 900
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- yiisoft/yii2: ~2.0.6
README
Library to validate input data(method,payload,headers)
Installation
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.
Usage
In any controller add behavior requestValidator.
Example:
public function behaviors() { return [ 'requestValidator' => [ 'class' => ActionValidator::className(), 'actions' => [ 'index' => [ 'get' => [ 'headers' => false, 'fields' => [ 'key' => '', 'recursiveKey' => ['key'] ], ] ], ], ] ]; }
TODO:
Bugfix: remote any value from fields
Add: field type validator. IsRequired, field type(\yii\validators) and default value
Add: Functional tests