Skip to content
This repository has been archived by the owner on Feb 10, 2021. It is now read-only.

Latest commit

 

History

History
55 lines (40 loc) · 2.28 KB

README.md

File metadata and controls

55 lines (40 loc) · 2.28 KB

Zxcvbn-PHP is a password strength estimator using pattern matching and minimum entropy calculation. Zxcvbn-PHP is based on the the Javascript zxcvbn project from Dropbox and @lowe. "zxcvbn" is bad password, just like "qwerty" and "123456".

zxcvbn attempts to give sound password advice through pattern matching and conservative entropy calculations. It finds 10k common passwords, common American names and surnames, common English words, and common patterns like dates, repeats (aaa), sequences (abcd), and QWERTY patterns.

Build Status Coverage Status Latest Stable Version License

Installation

The library can be installed with Composer by adding it as a dependency to your composer.json file.

{
    "require": {
        "mkopinsky/zxcvbn-php": "^4.4.2"
    }
}

After running php composer.phar update on the command line, include the autoloader in your PHP scripts so that the ZxcvbnPhp class is available.

require_once 'vendor/autoload.php';

Usage

use ZxcvbnPhp\Zxcvbn;

$userData = [
  'Marco',
  '[email protected]'
];

$zxcvbn = new Zxcvbn();
$strength = $zxcvbn->passwordStrength('password', $userData);
echo $strength['score'];
// will print 0

$strength = $zxcvbn->passwordStrength('correct horse battery staple');
echo $strength['score'];
// will print 4

Acknowledgements

Thanks to: