PHP code example of escuelait / custom-password-generator

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

    

escuelait / custom-password-generator example snippets


use Escuelait\CustomPasswordGenerator\PasswordGenerator;

$generator = new PasswordGenerator();

// Generate a 12-character password with 2 symbols (default settings)
$password = $generator->generate();

echo $password; // Example: @k1Zq9&Lm08A

$password = (new PasswordGenerator())
    ->length(16)   // Total length of the password
    ->symbols(4)   // Number of symbols to 

use Escuelait\CustomPasswordGenerator\PasswordGenerator;

$password = (new PasswordGenerator())
    ->length(20)
    ->symbols(5)
    ->generate();

echo $password;

InvalidArgumentException: The number of symbols cannot exceed the total password length