PHP code example of nsu-soft / yii-validation-snils
1. Go to this page and download the library: Download nsu-soft/yii-validation-snils 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/ */
nsu-soft / yii-validation-snils example snippets
namespace app\forms;
use nsusoft\validators\SnilsValidator;
use yii\base\Model;
class SnilsForm extends Model
{
public string $snils;
/**
* @inheritDoc
*/
public function rules(): array
{
return [
[['snils'], SnilsValidator::class],
];
}
/**
* @return bool
*/
public function save(): bool
{
if (!$this->validate()) {
return false;
}
// other form logic
return true;
}
}