byflav / yii2-phpass
integrate http://www.openwall.com/phpass/ in yii2
Installs: 268
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 0
Forks: 1
Open Issues: 0
Type:yii2-extension
Requires
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2025-01-22 20:46:03 UTC
README
Portable PHP password hashing framework in yii2 http://www.openwall.com/phpass/
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist byflav/yii2-phpass "*"
or add
"byflav/yii2-phpass": "*"
to the require section of your composer.json
file.
Usage
Once the extension is installed, simply use it in your code by :
1 setup component in config file app:
'components' => [
'security' => [
'class' => 'byflav\phpass\Security',
'iterationCountLog2' => 8, // integer > 3 and < 31 ; default 8;
'portableHashes' => false, // boolean; default false;
],
]
2 example use:
#create hash:
$hash = Yii::$app->getSecurity()->generatePasswordHash('lorem ipsum');
#validate hash: (return boolean)
return Yii::$app->getSecurity()->validatePassword('lorem ipsum', $hash);