定制 tbetool/php-password-generator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

tbetool/php-password-generator

最新稳定版本:v1.4

Composer 安装命令:

composer require tbetool/php-password-generator

包简介

PHP random and secure password generator class

README 文档

README

php class for random and secure password generation

Installation

composer require tbetool/php-password-generator

Usage

Create object

use TBETool\PasswordGenerator;

$passwordGenerator = new PasswordGenerator();

You can optionally pass following parameters to constructor

use TBETool\PasswordGenerator;

$passwordGenerator = new PasswordGenerator($length, $count, $characters);

Parameter Details

$length (int) : Length of the password to generate, Default: 8
$count (int) : No of passwords to generate, Default: 1
$characters (string): Characters to use while password generation

Supported Characters

  1. lower_case
  2. upper_case
  3. numbers
  4. special_symbols

Example with parameter

use TBETool\PasswordGenerator;

$passwordGenerator = new PasswordGenerator(16, 5, 'lower_case,numbers,special_symbols');

Set Parameters after creating object

Parameters set during object creation will be overwritten.

# Set lenght of password to 16
# params: (int) length
$passwordGenerator->setLength(16);

# Set number of passwords to generate
# params: (int) count
$passwordGenerator->setCount(5);

# Set characters to use in password
# params: (string) characters
$passwordGenerator->setCharacters('lower_case,numbers');

Generate Password

This will return single password from all passwords generated

@return string of password
$password = $passwordGenerator->generate();

Get All Generated Passwords

@return array of passwords
$passwords = $passwordGenerator->getPasswords();

Get new password from generated passwords

@return string of new password
$password = $passwordGenerator->getPassword();

Get last accessed password

@return string of last password retrieved
$password = $passwordGenerator->getLastPassword();

Developer

Anuj Sharma (https://anujsh.in)

Package

TBE (http://thebornengineer.com)

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2017-10-20