unique / was-password-pwned
A small tool to check if a password has been leaked against haveibeenpwned.com database.
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 1
Open Issues: 0
pkg:composer/unique/was-password-pwned
Requires
- php: >=7.4
- guzzlehttp/guzzle: ^7.0.0
Requires (Dev)
- phpunit/phpunit: ^9.4
This package is auto-updated.
Last update: 2025-10-21 02:49:03 UTC
README
A small tool to check if a password has been leaked against haveibeenpwned.com database.
Installation
This component requires php >= 7.4. To install it, you can use composer:
composer require unique/was-password-pwned
Usage
$checker = new PasswordChecker(); $count = $checker->checkIfPasswordPwned( sha1( 'my-password' ) ); if ( $count ) { echo 'Your password has been leaked and found in ' . $count . ' databases.'; } elseif ( $count === null ) { if ( $checker->getLastException() ) { echo (string) $checker->getLastException(); } else { echo 'An error has occured.'; } }
haveibeenpwned.com usage and license
Please read https://haveibeenpwned.com/API/v3#AcceptableUse for acceptable use of haveibeenpwned.com service and attribute it according to the author: https://haveibeenpwned.com/API/v3#License.