PwnedPasswords for Laravel 11.x/12.x/13.x
nickurt/laravel-pwned-passwords is a Laravel package for pwnedpasswords for laravel 11.x/12.x/13.x.
It currently has 18 GitHub stars and 7.700 downloads on Packagist (latest version 2.1).
Install it with composer require nickurt/laravel-pwned-passwords.
Discover more Laravel packages by nickurt
or browse all Laravel packages to compare alternatives.
Last updated
Install this package with composer:
composer require nickurt/laravel-pwned-passwords
Copy the config files for the PwnedPasswords-plugin
php artisan vendor:publish --provider="nickurt\PwnedPasswords\ServiceProvider" --tag="config"
// FormRequest ...
public function rules()
{
return [
'password' => ['required', new \nickurt\PwnedPasswords\Rules\IsPwnedPassword(20)]
];
}
// Manually ...
$validator = validator()->make(request()->all(), ['password' => ['required', new \nickurt\PwnedPasswords\Rules\IsPwnedPassword(20)]]);
The IsPwnedPassword-rule has one optional paramter frequency (default 10) to validate the request.
$isPwnedPassword = \PwnedPasswords::setFrequency(20)
->setPassword('laravel-pwned-passwords')
->isPwnedPassword();
You can listen to the IsPwnedPassword event, e.g. if you want to log the IsPwnedPassword-requests in your application
This event will be fired when the password is above the frequency of pwned passwords
nickurt\PwnedPasswords\Events\IsPwnedPassword
composer test