rlvendramini / randompassword
Simple Random Password Generate Class
Requires
- php: >=5.2
This package is auto-updated.
Last update: 2025-01-08 21:11:13 UTC
README
Simple PHP static class to generate random passwords
How does it work?
You can simple load the class and call the generate method to get your random password. If you want more options, you can customize your password's length and characters's types.
Usage
Install
$ composer require rlvendramini/random-password
Setup
It's very simple:
Require the autoload composer's generated class...
require __DIR__ . '/vendor/autoload.php';
...and then generate a password!
$password = RandomPassword::generate();
Set password length
Choose the new password's length giving it as the generate
function's first parameter
$password = RandomPassword::generate(30);
If you dont't, default length is 20.
Set characters types
Choose your prefered characters types from the following options: 'lowercase' : Lowercase characters, 'uppercase' : Uppercase characters, 'numbers' : Numbers, 'special' : Special characters
and then give an array of options as generate
function's second parameter
$password = RandomPassword::generate(20, ['lowercase', 'uppercase']);
If you don't, all types are selected by default