PHP code example of zhuravljov / yii2-calc-validator
1. Go to this page and download the library: Download zhuravljov/yii2-calc-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/ */
zhuravljov / yii2-calc-validator example snippets
public function rules()
{
return [
// ...
// Rule for checking an expression
['amount1', 'zhuravljov\yii\validators\CalcValidator'],
// Rule for checking an expressions with saving result of calculation
['amount2', 'zhuravljov\yii\validators\CalcValidator', 'resultAttribute' => 'amount2'],
// ...
];
}