PHP code example of laszlof / php-hibp

1. Go to this page and download the library: Download laszlof/php-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/ */

    

laszlof / php-hibp example snippets



use Hibp\Hibp;

$account = '[email protected]';
$breaches = Hibp::getBreaches($account);


use Hibp\Hibp;

$name = 'Adobe';
$breach = Hibp::getBreach($account);


use Hibp\Hibp;

$breaches = Hibp::getBreachedSites();

$domain = 'adobe.com';
$breaches = Hibp::getBreachedSites($domain);


use Hibp\Hibp;

$dataClasses = Hibp::getDataClasses();


use Hibp\Hibp;

$account = '[email protected]';
$breaches = Hibp::getPastes($account);


use Hibp\Hibp;

$password = 'password123';
$isCompromised = Hibp::checkPassword($password);

// Optionally check with a password that IS a hash itself.
$password_is_a_hash = '5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8';
$isCompromised = Hibp::checkPassword($password_is_a_hash, true);
bash
composer