PHP code example of losthost / passg

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

    

losthost / passg example snippets


use losthost\passg\Pass;

$new_password = Pass::generate();

use losthost\passg\Pass;

$new_password = Pass::generate(4, '0123456789');

use losthost\passg\Pass;

// Generate a 14-symbol password that contains at least 1 symbol of each class
$new_password_1 = Pass::generate(14, [
    Pass::ALL_LOWERCASE,
    Pass::ALL_UPPERCASE,
    Pass::ALL_DIGITS,
    Pass::ALL_SYMBOLS
]); 
        // ex. P3H{nh"/|S2.?|

// Generate a 10-symbol password that contains at least 3 digits and 3 lowercase letters
$new_password_2 = Pass::generate(10, [
    Pass::CLEAN_DIGITS, 
    Pass::CLEAN_LOWERCASE
], 3); 
        // ex. 6kf5czqi86

// Generate a 4-digits password that contain at least 2 `5`
$new_password_3 = Pass::generate(4, [
    '012346789', '5'
], 2); 
        // ex. 5751