harlam/password

Simple password manager

v1.0.0 2019-03-17 11:10 UTC

README

Simple password manager

// Init
$password = (new \harlam\Password\Password())
    ->setPasswordLength(9, 25)
    ->setPasswordComplexity(function (string $password) {
        if (preg_match('/[A-Z]/', $password) !== 1) {
            throw new RuntimeException('The password has to contain at least one capital letter');
        }
    })->setPasswordComplexity(function (string $password) {
        if (preg_match('/[0-9]/', $password) !== 1) {
            throw new RuntimeException('The password has to contain at least one digit');
        }
    });

$hash = $password->setPassword('RieOdb7Ys')->validate()->hash();

$isValid = $password->verify($hash);