PHP code example of romi45 / yii2-json-validator

1. Go to this page and download the library: Download romi45/yii2-json-validator 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/ */

    

romi45 / yii2-json-validator example snippets




namespace app\models;

use yii\base\Model;
use romi45\yii2jsonvalidator\JsonValidator;

class Foo extends Model
{
    public $bar;

    public function rules()
    {
        return [['bar', JsonValidator::class]];
    }
}