averay / password-validator
An object-oriented wrapper around the password_hash & password_verify functions.
v1.0.0
2024-02-23 11:48 UTC
Requires
- php: >=8.2
Requires (Dev)
- phpunit/php-code-coverage: ^10.1
- phpunit/phpunit: ^10.5
- vimeo/psalm: ^5.22.2
README
An object-oriented wrapper around the PHP password_hash
& password_verify
functions, including an interface for abstraction.
Usage
<?php $passwordValidator = new \Averay\PasswordValidator\PasswordValidator(); $hash = $passwordValidator->hash('secret value'); if ($passwordValidator->verify('secret value', $hash)) { echo '✅ Correct'; } else { echo '❌ Incorrect'; }
The algorithm may be customised during instantiation:
<?php $passwordValidator = new \Averay\PasswordValidator\PasswordValidator( \PASSWORD_ARGON2I, ['memory_cost' => 2 ^ 32, 'time_cost' => 10], );