PHP code example of nstcactus / yii2-pwned-validator

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

    

nstcactus / yii2-pwned-validator example snippets




namespace app\models;

use nstCactus\yii2\validators\PwnedValidator;
use Yii;
use yii\base\Model;

class YourCustomModel extends Model
{
    public function rules()
    {
        return [
            ['newPassword', PwnedValidator::class],
        ];
    }

    public function attributeLabels()
    {
        return [
            'newPassword' => Yii::t('app', 'New password'),
        ];
    }
}