PHP code example of divineomega / password_exposed

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

    

divineomega / password_exposed example snippets


switch(password_exposed('hunter2')) {

    case PasswordStatus::EXPOSED:
        // Password has been exposed in a data breach.
        break;

    case PasswordStatus::NOT_EXPOSED:
        // Password has not been exposed in a known data breach.
        break;

    case PasswordStatus::UNKNOWN:
        // Unable to check password due to an API error.
        break;
}

$passwordStatus = (new PasswordExposedChecker())->passwordExposed($password);

$passwordStatus = (new PasswordExposedChecker())->passwordExposedByHash($hash);

$passwordStatus = password_exposed_by_hash($hash);