PHP code example of natanael-aguiar / secure-password-generator

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

    

natanael-aguiar / secure-password-generator example snippets




ecurePasswordGenerator\SecurePasswordGenerator;

$generator = new SecurePasswordGenerator();

$generator->allowLowercase(true);
$generator->allowUppercase(true);
$generator->allowNumbers(true);
$generator->allowSpecialCharacters(true);

// Generate a secure password of length 8
try {
    $password = $generator->generatePassword(8);
    echo($password);
} catch (Exception $e) {
    echo($e);
}