PHP code example of ron-maxweb / pwned-passwords
1. Go to this page and download the library: Download ron-maxweb/pwned-passwords 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/ */
ron-maxweb / pwned-passwords example snippets
$pp = new PwnedPasswords\PwnedPasswords;
$password = '123456789';
$insecure = $pp->isPwned($password); //returns true or false
$pp = new PwnedPasswords\PwnedPasswords;
$password = '123456789';
$insecure = $pp->isPwned($password, true);
if ($insecure) {
echo 'Oh no — pwned!' . "\n";
echo sprintf('This password has been seen %d time%s before.', $insecure, ($insecure > 1 ? 's' : ''));
} else {
echo 'All good!';
}