承接 mcrumley/php-complexify 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mcrumley/php-complexify

最新稳定版本:v0.4.1

Composer 安装命令:

composer require mcrumley/php-complexify

包简介

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

README 文档

README

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

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.

$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:

  • 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.

Version History

0.4 - Changed banmode option to banMode

0.3.1 - Added composer support

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

统计信息

  • 总下载量: 153.8k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 10
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 10
  • Watchers: 3
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: WTFPL
  • 更新时间: 2015-03-10