nickurt/laravel-pwned-passwords
Laravel Pwned Passwords
Installation
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"
Examples
Validation Rule - IsPwnedPassword
// 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.
Manually Usage - IsPwnedPassword
$isPwnedPassword = \PwnedPasswords::setFrequency(20)
->setPassword('laravel-pwned-passwords')
->isPwnedPassword();
Events
You can listen to the IsPwnedPassword event, e.g. if you want to log the IsPwnedPassword-requests in your application
IsPwnedPassword Event
This event will be fired when the password is above the frequency of pwned passwords
nickurt\PwnedPasswords\Events\IsPwnedPassword
Tests
composer test
Related Packages
doctrine/dbal
Powerful PHP database abstraction layer (DBAL) with many features for database s...
641,106,524
9,700
laravel/serializable-closure
Laravel Serializable Closure provides an easy and secure way to serialize closur...
418,291,778
609
nunomaduro/collision
Cli error handling for console/command-line PHP applications.
394,964,158
4,660
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 2.1 | ^8.2 | ^11.0| | MIT | |
| 2.0 | ^8.2 | ^11.0| | MIT | |
| 1.11 | ^8.2 | ^10.0| | MIT | |
| 1.10 | ^8.1 | ^9.0| | MIT | |
| 1.9 | ^8.0| | ^6.0| | MIT | |
| 1.8 | ^8.0| | ^6.0| | MIT | |
| 1.7 | ^7.2 | ^6.0| | MIT | |
| 1.6 | ^7.2 | ^6.0| | MIT | |
| 1.5 | ^7.2 | ^5.8| | MIT | |
| 1.4 | ^7.2 | ^5.8| | MIT | |
| 1.3 | ^7.2 | 5.8.* | MIT | |
| 1.2 | ^7.2 | 5.8.* | MIT | |
| 1.1 | ^7.1.3 | 5.7.* | MIT | |
| 1.0 | ^7.0 | ~5.5.0| | MIT |