darkotodoric/password-strength-validator

A lightweight PHP library for checking password strength

v1.0.1 2024-01-28 13:44 UTC

This package is auto-updated.

Last update: 2024-05-28 14:41:18 UTC


README

Packagist License Packagist Version

A lightweight PHP library for checking password strength

Installation

Install the latest version with:

$ composer require darkotodoric/password-strength-validator

Usage

<?php

require_once 'vendor/autoload.php';

$password = 'darkoTODORIC123@';
$passwordStrengthValidator = new PasswordStrengthValidator($password);

if($passwordStrengthValidator->isValid()){
    // message here
}

Parameters

The class constructor for PasswordStrengthValidator accepts the following parameters:

  • password (string, required): The password string to be evaluated for strength.
  • minLength (int, optional, default: 6): Specifies the minimum required length for the password.
  • requireSpecialChar (bool, optional, default: true): Indicates whether the password must contain at least one special character.
  • requireNumber (bool, optional, default: true): Specifies whether the password must contain at least one numeric digit.
  • requireUpperCase (bool, optional, default: true): Determines whether the password must include at least one uppercase letter.
  • requireLowerCase (bool, optional, default: true): Specifies whether the password must include at least one lowercase letter.

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests to improve this project.