PHP code example of snipershady / pwned-password-check
1. Go to this page and download the library: Download snipershady/pwned-password-check 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/ */
snipershady / pwned-password-check example snippets
use PwnedPassCheck\Service\PwnedPasswordCheckerService;
class fooClass(){
public function checkIfPasswordHasBeenPowned(): string {
$pownedPassChecker = new PwnedPasswordCheckerService();
if(pownedPassChecker->hasPowned($password)){
return json_encode(["powned" => true, "msg"=> "Your password has been powned and is unsafe"]);
}
return return json_encode(["powned" => false, "msg"=> "Your password was not been powned"]);
}
}