1. Go to this page and download the library: Download groupesti/laravel-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/ */
groupesti / laravel-password example snippets
use Password\Password;
$request->validate([
'password' => Password::min(12)
->letters(1) // >= 1 letter
->mixedCase(1) // >= 1 uppercase and >= 1 lowercase
->numbers(2) // >= 2 digits
->symbols(1) // >= 1 symbol
->upperCase(1, 3) // min/max bounds per case
->allowSpaces(false)
->maxConsecutive(3) // no more than 3 identical characters in a row
->maxRepeats(4) // a character at most 4 times
->maxSequential(4) // no run (abc / 123) longer than 4
->noKeyboardPatterns() // forbid azerty/qwerty
->notContainsUserInfo() // forbid name/email/username
->notContains() // forbidden-word dictionary
->normalize() // NFKC + reject control characters
->uncompromised() // HaveIBeenPwned
->blocklists(), // internal file + DB blocklists
]);
use Password\Traits\ManagesPasswordLifecycle;
use Password\Interfaces\PasswordLifecycle;
class User extends Authenticatable implements PasswordLifecycle
{
use ManagesPasswordLifecycle;
}
use Password\Rules\NotReused;
$request->validate([
'password' => [Password::defaults(), NotReused::for($request->user())],
]);