Looking to hire Laravel developers? Try LaraJobs

laravel-stupid-password maintained by woodynadobhar

Description
A laravel package wrapper for northox/stupid-password
Last update
2025/01/15 21:36 (dev-master)
License
Links
Downloads
1 380

Comments
comments powered by Disqus

LaravelStupidPassword

Latest Version on Packagist Total Downloads

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

License

This package is licensed under the BSD License. In other words, it is free software.