woodynadobhar / laravel-stupid-password
A laravel package wrapper for northox/stupid-password
Installs: 1 327
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- northox/stupid-password: ^2.0
This package is auto-updated.
Last update: 2025-02-15 20:51:21 UTC
README
A Laravel package wrapper for Northox Stupid Password.
Installation
Install the package via Composer:
composer require woodynadobhar/laravelstupidpassword
Publish the configuration file:
php artisan vendor:publish --provider="WoodyNaDobhar\\LaravelStupidPassword\\LaravelStupidPasswordServiceProvider" --tag=config
This will create a configuration file at config/laravelstupidpassword.php
.
Usage
Automatically
To enforce password strength validation, simply add stupidpassword
to your validation rules:
'password' => 'min:6|required_with:password_confirmation|same:password_confirmation|stupidpassword',
Manually
You can also validate passwords manually by using the LaravelStupidPassword
class:
use WoodyNaDobhar\LaravelStupidPassword\LaravelStupidPassword; $stupidPass = new LaravelStupidPassword( config('laravelstupidpassword.max'), config('laravelstupidpassword.environmentals'), null, null, config('laravelstupidpassword.options') ); if (!$stupidPass->validate($input['password'])) { $errors = implode(' ', $stupidPass->getErrors()); throw new \Exception("Your password is too weak: $errors"); }
Configuration
The configuration file laravelstupidpassword.php
allows customization of the following options:
- max: Maximum number of passwords to evaluate.
- environmentals: An array of additional weak passwords to consider.
- options: Advanced configuration options specific to the Northox Stupid Password library.
Dependencies
This package is a Laravel wrapper for Northox Stupid Password.
Change Log
Please see the CHANGELOG for details on recent changes.
Contributing
See CONTRIBUTING for guidelines and a to-do list.
Security
If you discover any security-related issues, please contact the Northox Stupid Password repository owner.
Versioning
This package follows Semantic Versioning (SemVer). Updates are published to Packagist.
Credits
- Danny Fullerton for the Stupid Password library.
- Krisjanis Ozolins for the Laravel package template.
- All Contributors
License
This package is licensed under the BSD License. In other words, it is free software.