PHP code example of kevinlebrun / password.php

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

    

kevinlebrun / password.php example snippets


#!/usr/bin/env php


rd\Generator;
$generator->setMinLength(8);
$generator->setNumberOfUpperCaseLetters(2);
$generator->setNumberOfNumbers(2);
$generator->setNumberOfSymbols(1);

$password = $generator->generate();
echo 'password: ' . $password . PHP_EOL;

$validator = new \Password\Validator(new \Password\StringHelper);
$validator->setMinLength(5);
$validator->setMinLowerCaseLetters(2);
$validator->setMinUpperCaseLetters(1);
$validator->setMinNumbers(1);
$validator->setMinSymbols(3);

if ($validator->isValid($password)) {
    printf('password %s is valid' . PHP_EOL, $password);
} else {
    printf('password %s is invalid' . PHP_EOL, $password);
    var_dump($validator->getErrors());
}
json
{
    "evinlebrun/password.php": "0.*"
    }
}