PHP code example of libriciel / php-password

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

    

libriciel / php-password example snippets


use Libriciel\Utility\Password\PasswordStrengthMeterAnssi;

$pwdStrengthAnssi = new  PasswordStrengthMeterAnssi();
// L'entropie, ici 61
$pwdStrengthAnssi->entropy('mot de passe');

// La force (entre 1, très faible et 5, très fort), ici 1
$pwdStrengthAnssi->strength('mot de passe');

use Libriciel\Utility\Password\PasswordGeneratorAnssi;

// Configuration complète par défaut
$config = [
    'binary'  => false,
    // de 0 à 9
    'numbers'  => true,
    'lowercase_hexadecimal' => false,
    'uppercase_hexadecimal' => false,
    // de a à z
    'lowercase_letters' => true,
    // A à Z
    'uppercase_letters' => true,
    'symbols_1' => false,
    'symbols_2' => false,
    'lowercase_accents_fr' => false,
    'uppercase_accents_fr' => false
];

$pwdGeneratorAnssi = new PasswordGeneratorAnssi();
// Exemple de sortie: MUAVGHF4O5VPDboTwSJebjwNcryqYmRSS2izJHyJ
$pwdGeneratorAnssi->generate();