acurrieclark/php-password-verifier
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.
acurrieclark/php-password-verifier 适用场景与选型建议
acurrieclark/php-password-verifier 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 72.23k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2016 年 08 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 acurrieclark/php-password-verifier 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 acurrieclark/php-password-verifier 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 72.23k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 31
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-08-12