PHP code example of siteworxpro / password-score

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

    

siteworxpro / password-score example snippets


$scorer = \Siteworx\Passwords\Scorer::score('SuperPassword!');

echo json_encode($scorer->toArray());


if ($scorer->isExcellent()) {
    echo 'Your password is excellent :)';
}
if ($scorer->isPoor()) {
    echo 'Your password is poor :(';
}

echo 'Your Password is ' . $scorer->stringValue();

$scorer = \Siteworx\Passwords\Scorer::score('N0wAStrongPassword!', -5);
echo 'This password is ' . $scorer->stringValue();
$scorer = \Siteworx\Passwords\Scorer::score('N0wAStrongPassword!', 0);
echo 'This password is ' . $scorer->stringValue();
$scorer = \Siteworx\Passwords\Scorer::score('N0wAStrongPassword!', 5);
echo 'This password is ' . $scorer->stringValue();