2017 © Pedro Peláez
 

library php-complexify

PHP port of Dan Palmer's jquery.complexify.js

image

mcrumley/php-complexify

PHP port of Dan Palmer's jquery.complexify.js

  • Tuesday, February 20, 2018
  • by mcrumley
  • Repository
  • 3 Watchers
  • 11 Stars
  • 14,683 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 5 Forks
  • 1 Open issues
  • 4 Versions
  • 5 % Grown

The README.md

php-complexify

PHP port of Dan Palmer's jquery.complexify.js, (*1)

Installation

composer require mcrumley/php-complexify

Usage

$check = new \Complexify\Complexify();
$result = $check->evaluateSecurity('correct horse battery staple');

echo round($result->complexity, 1) . '% ';
if ($result->valid) {
    echo 'VALID';
} else {
    echo 'NOT VALID: '.implode(', ', $result->errors);
}

Configuration

You can override the default configuration by passing an array to the constructor., (*2)

$check = new \Complexify\Complexify(array(
    'minimumChars' => 8,          // the minimum acceptable password length
    'strengthScaleFactor' => 1,   // scale the required password strength (higher numbers require a more complex password)
    'bannedPasswords' => array(), // override the default banned password list
    'banMode' => 'strict',        // strict == don't allow substrings of banned passwords, loose == only ban exact matches
    'encoding' => 'UTF-8',        // password string encoding
));

Return value

The evaluateSecurity method returns an object containing the following properties:, (*3)

  • valid - TRUE if the password passes all checks
  • complexity - The calculated complexity as a percent of the maximum (25 characters with at least one from each set)
  • errors - Zero or more strings explaining the checks that did not pass
    • banned
    • tooshort
    • toosimple

License

This code is distributed under the WTFPL v2 licence., (*4)

Version History

0.4 - Changed banmode option to banMode, (*5)

0.3.1 - Added composer support, (*6)

0.3 - First release (matched version number of the JS version), (*7)

The Versions

20/02 2018

dev-master

9999999-dev

PHP port of Dan Palmer's jquery.complexify.js

  Sources   Download

WTFPL WTFPL v2

20/02 2018

v0.4.1

0.4.1.0

PHP port of Dan Palmer's jquery.complexify.js

  Sources   Download

WTFPL

25/03 2015

v0.4

0.4.0.0

PHP port of Dan Palmer's jquery.complexify.js

  Sources   Download

WTFPL v2

10/03 2015

v0.3.1

0.3.1.0

PHP port of Dan Palmer's jquery.complexify.js

  Sources   Download

WTFPL v2