Configuration

installation

Before using the validator, you need to install the validator component, which is installed as follows:

 composer require swoft/validator 

Enable

After successfully installing the verification component, you need to enable the validator. Here is Http-server enabled as an example, the other is the same (app/bean.php)

 return [
    // ......
    'httpDispatcher'    => [
        // ......
        'afterMiddlewares' => [
            \Swoft\Http\Server\Middleware\ValidatorMiddleware::class
        ]
        // ......
    ],
    // ......
]; 

2.0.5+ The validator does not start by default and requires the developer to open it.

/docs/2.x/en/validator/setting.html
progress-bar