acurrieclark/php-password-verifier 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

acurrieclark/php-password-verifier

最新稳定版本:v1.1

Composer 安装命令:

composer require acurrieclark/php-password-verifier

包简介

Framework agnostic password strength checker

README 文档

README

A framework agnostic password checker for PHP.

Installation

$ composer require acurrieclark/php-password-verifier

Usage

// include autoloader if you haven't already
include_once('vendor/autoload.php');

use acurrieclark\PhpPasswordVerifier\Verifier;

// create an instance
$passwordVerifier = new Verifier();

// default options are permissive, so  each constraint needs to be set as required
$passwordVerifier->setMinLength(8);

// constraints can also be chained
$passwordVerifier->setMaxLength(128)->setCheckContainsNumbers(true);

// check the password meets the requirements set (min length 8, max length 128, contains numbers)

$validPassword = $passwordVerifier->checkPassword("passwordToCheck");

Class Methods

Setting Password Constraints

setMinLength(int $length)

Set the minimum required length of the password

setMaxLength(int $length)

Set the maximum allowed length of the password

setCheckContainsLetters(boolean $value)

Set the flag to check that the password contains at least one letter

setCheckContainsCapitals(boolean $value)

Set the flag to check that the password contains at least one capital letter

setCheckContainsNumbers(boolean $value)

Set the flag to check that the password contains at least one number

setCheckContainsNumbers(boolean $value)

Set the flag to check that the password contains at least one number

setCheckContainsSpecialChrs(boolean $value)

Set the flag to check that the password contains at least one special character from {}()[]#,:;^.?!|&_`~@$%/\\=+-*"'

setCheckBlacklist(boolean $value)

Set the flag to check if the password matches one of the 10000 most popular passwords from https://github.com/danielmiessler/SecLists

Checking the Password

checkPassword(string $password)

Verify the password based on the constraints imposed. Returns boolean.

getErrors()

Returns an array of errors relating to the verified password

Utility

getSpecialChrs()

Static: Returns an array of the special characters used to check against when setCheckContainsSpecialChrs(true) has been set. Handy if you want to warn your users which characters they need to include.

License

The MIT License (MIT). Please see the License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-08-12