Skip to content
This repository has been archived by the owner on Apr 25, 2019. It is now read-only.

wirwolf/yii2-request-validator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Yii2 Request Validator

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages