PHP code example of beeflow / passwd

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

    

beeflow / passwd example snippets




 use Beeflow\Passwd\Passwd;

 // I am changing default password policy
 $passwordPolicy = array('specialCharsCount' => 3, 'minimumPasswordLength' => 12);

 $password = new Passwd( $passwordPolicy );

 // checking password
 $isPasswordOk = $password->check('Th1$I$myPrd!');
 if (!$isPasswordOk) {
    echo "Your password is incorrect.<br/>";
 } else {
    echo "Your password is correct.<br/>";
 }

 // checking password strength
 $password->checkStrength('Th1$I$myPrd!', 'info');
 echo "Your password strength points: " . $password->getStrengthPoints()."<br/>";
 echo "Your password strength info: " . $password->getStrengthInfo()."<br/>";

 // generating new password
 echo "Your new password: " . $password->generate() ."<br/>";