To be able to use this library in your project, follow the steps below
- php 5.5 >=
- Composer (for installing the library)
- Gitbash (for running the composer from the command line)
To install the package in your project, run this command from the command line interface(cli) using gitbash
composer require walegbenga/php_password_generator
. This will download the library into your project.
To use the library in your project, require the composer autoload script into your project like this
require __DIR__ . '/vendor/autoload.php
You can now use the library to generate the Random password for your users like this
$passGen = new \SecurePassword\PasswordGenerator($source, 4, CACHE_DIR);
echo $passGen->generate();
include __DIR__ . '/vendor/autoload.php';// Generally, this should be the relative path to the **vendor** folder
$passGen = new \SecurePassword\PasswordGenerator($source, 4, CACHE_DIR);
echo $passGen->generate();
You can use this library to
- Generate hard to guess passwords for your users
- Use it to generate a temporary passwords for users who forgot there passsword
- Use it to generate a token for users
- Use it to generate Serial Number(sn) for your users and so on and so on Remember, in programming, your imagination is your limitation
The above example is just a basic usage of using the library.