generate password hash yii2 code example Example: hashing passwords in yii 1 $hash = Yii::$app->getSecurity()->generatePasswordHash($password);