PHP code example of vloop / yii2-custom-validators

1. Go to this page and download the library: Download vloop/yii2-custom-validators library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

vloop / yii2-custom-validators example snippets


 rules() {
    return 
        [
           'data',
           ArrayValidator::class,
           'subRules' => [
               [['foo', 'bar'], '
                   'subRules' => [
                       ['id', 'iative array
                   CustomEachValidator::class,
                   'rule' => [
                       ArrayValidator::class,
                       'subRules' => [
                           [['type', 'sum'], 'equired', 'message' => '[email] cannot be blank when [phone] is blank', 'when' => static function($client) {
                           return empty($client->phone);
                       }],
                       ['phone', '