athiq / password_generator
1.0.0
2024-03-21 13:01 UTC
This package is auto-updated.
Last update: 2024-09-22 09:23:47 UTC
README
此PHP包提供了生成强大且安全的密码的功能,具有各种可自定义的选项。
安装
您可以通过Composer安装此包。在您的终端中运行以下命令
composer require athiq/password_generator
用法
<?php require 'vendor/autoload.php'; use athiq\PasswordGenerator\PasswordGenerator; // Create an instance of PasswordGenerator $passwordGenerator = new PasswordGenerator(); // Generate a password of default length (8 characters) $password = $passwordGenerator->generatePassword(); echo "Generated Password: " . $password . "\n"; // Generate a password of specific length $password = $passwordGenerator->generatePassword(12); echo "Generated Password (Length 12): " . $password . "\n"; // Generate a password with uppercase, lowercase, digits, and special characters $password = $passwordGenerator->generatePassword(8, true, true, true, true); echo "Generated Password (With Uppercase, Lowercase, Digits, and Special Characters): " . $password . "\n";
选项
length
: 整数,生成的密码长度(默认为8)。includeUppercase
: 布尔值,是否在生成的密码中包含大写字母(默认为true)。includeLowercase
: 布尔值,是否在生成的密码中包含小写字母(默认为true)。includeDigits
: 布尔值,是否在生成的密码中包含数字(默认为true)。includeSpecialChars
: 布尔值,是否在生成的密码中包含特殊字符(默认为false)。
许可证
此包使用MIT许可证。请随意将其用于您的项目!