PHP code example of dragonbe / hibp
1. Go to this page and download the library: Download dragonbe/hibp 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/ */
dragonbe / hibp example snippets
= \Dragonbe\Hibp\HibpFactory::create();
echo 'Password "password": ' . ($hibp->isPwnedPassword('password') ? 'Pwned' : 'OK') . PHP_EOL;
echo 'Password "NVt3MpvQ": ' . ($hibp->isPwnedPassword('NVt3MpvQ') ? 'Pwned' : 'OK') . PHP_EOL;
= \Dragonbe\Hibp\HibpFactory::create();
$passwords = ['password', 'NVt3MpvQ'];
foreach ($passwords as $password) {
$found = $hibp->isPwnedPassword($password);
$count = count($hibp);
echo sprintf(
'Password "%s": %s',
$password,
$found ? ('Pwned (' . $count . ' times)') : 'OK'
) . PHP_EOL;
}
php hibp.php