jerezjustin / random-password-generator
Basic and easy-to-use random password generator
v1.0.1
2023-11-22 17:36 UTC
Requires
- php: ^8.0
Requires (Dev)
- phpunit/phpunit: ^10.4
README
This is a basic password generator created with the finality of learning the process of creating packages using PHP.
How to use
To install the package just run the following command in the terminal:
composer require jerezjustin/random-password-generator
The password generator is easy to use it consists of only one class to generate password. Here is an example of how can you use it.
$passwordGenerator = new JerezJustin\PasswordGenerator(); $password = $passwordGenerator->generate();
By default, the password generator will include lowercase, uppercase and numeric characters, and it will have a default length of 8 characters. This can be changed by providing a value for the different arguments to the constructor of the class.
$passwordGenerator = new JerezJustin\PasswordGenerator( length: 8, lowercase: true, uppercase: true, numbers: true, specialCharacters: false ); $password = $passwordGenerator->generate();
Additionally, you can call methods to configure the password generator as in the following example:
$passwordGenerator = new JerezJustin\PasswordGenerator(); $password = $passwordGenerator ->length(8) ->includeLowercase(true) ->includeUppercase(true) ->includeNumbers(true) ->includeSpecialCharacters(false) ->generate();