1. Go to this page and download the library: Download ronald-ph/strong-pass 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/ */
ronald-ph / strong-pass example snippets
$checker = new RonaldPh\StrongPass\PasswordChecker();
$result = $checker->inspect($password);
use RonaldPh\StrongPass\PasswordChecker;
$checker = new PasswordChecker();
$result = $checker->inspect($_POST['password'] ?? '');
if ($result->failed()) {
echo htmlspecialchars($result->message(), ENT_QUOTES, 'UTF-8');
}
use RonaldPh\StrongPass\Facades\StrongPass;
public function register(Request $request)
{
StrongPass::check($request);
// Only reached when the password passed.
$user = User::create($request->all());
return redirect()->route('dashboard');
}
$result = StrongPass::check($request); // only returns if it passed
$result->score;
StrongPass::check($request); // password only, no password_confirmation
$request->validate([
'email' => ['d', new StrongPasswordRule],
]);
$result = StrongPass::inspect('correct horse battery staple');
$result->passed(); // bool
$result->score; // 0-4
$result->entropy; // estimated bits
$result->feedback; // array of suggestions
$result->blockedBy; // 'config', 'pwned', or null
$result->standard; // which standard judged it