использование hackzilla/password-generator
есть много вариантов для создания паролей разного типа:
ComputerPasswordGenerator()
HybridPasswordGenerator()
-> sjgX-PFjH-zxMz-PRDz-G6mx-wMJ4-ST24
HumanPasswordGenerator()
-> Verkuemmerungen-verlottertet-dreinzuschauen
(на основе списка слов. В данном случае это список немецких слов)
RequirementPasswordGenerator()
ComputerPasswordGenerator
$generator
->setOptionValue(ComputerPasswordGenerator::OPTION_UPPER_CASE, true)
->setOptionValue(ComputerPasswordGenerator::OPTION_LOWER_CASE, true)
->setOptionValue(ComputerPasswordGenerator::OPTION_NUMBERS, true)
->setOptionValue(ComputerPasswordGenerator::OPTION_SYMBOLS, false)
;
$password = $generator->generatePassword();
RequirementPasswordGenerator
$generator
->setLength(16)
->setOptionValue(RequirementPasswordGenerator::OPTION_UPPER_CASE, true)
->setOptionValue(RequirementPasswordGenerator::OPTION_LOWER_CASE, true)
->setOptionValue(RequirementPasswordGenerator::OPTION_NUMBERS, true)
->setOptionValue(RequirementPasswordGenerator::OPTION_SYMBOLS, true)
->setMinimumCount(RequirementPasswordGenerator::OPTION_UPPER_CASE, 2)
->setMinimumCount(RequirementPasswordGenerator::OPTION_LOWER_CASE, 2)
->setMinimumCount(RequirementPasswordGenerator::OPTION_NUMBERS, 2)
->setMinimumCount(RequirementPasswordGenerator::OPTION_SYMBOLS, 2)
->setMaximumCount(RequirementPasswordGenerator::OPTION_UPPER_CASE, 8)
->setMaximumCount(RequirementPasswordGenerator::OPTION_LOWER_CASE, 8)
->setMaximumCount(RequirementPasswordGenerator::OPTION_NUMBERS, 8)
->setMaximumCount(RequirementPasswordGenerator::OPTION_SYMBOLS, 8)
;
$password = $generator->generatePassword();