PHP code example of mkopinsky / zxcvbn-php

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

    

mkopinsky / zxcvbn-php example snippets




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