devuri / secure-password
A PHP package to generate cryptographically secure passwords and passcodes
Installs: 2 210
Dependents: 3
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^7.4 || ^8.0
- devuri/uuid-generator: ^0.0.1
Requires (Dev)
- 10up/phpcs-composer: dev-master
- phpstan/phpstan: ^1.8
- phpstan/phpstan-strict-rules: ^1.3
- phpunit/phpunit: ^9.5
- szepeviktor/phpstan-wordpress: ^1.1
- vimeo/psalm: ^4.24 || ^5.0
Suggests
- daniel-zahariev/php-aws-ses: Send emails via Amazon Simple Email Service (SES).
- ibericode/vat: PHP library to help you deal with Europe's VAT rules.
- itsgoingd/clockwork: php dev tools in your browser.
- latitude/latitude: SQL query builder with zero dependencies.
- predis/predis: A flexible and feature-complete Redis client for PHP.
- spatie/ssh: execute commands over an SSH connection
This package is auto-updated.
Last update: 2024-12-06 06:15:09 UTC
README
Secure Password Generator is a PHP package that allows you to generate cryptographically secure passwords and passcodes.
Installation
You can install the package using Composer. Run the following command:
composer require devuri/secure-password
Usage
Generating a Password
To generate a password, you can use the PasswordGenerator::generatePassword()
method. By default, it generates a password with a length of 8 characters and includes special characters.
use Urisoft\PasswordGenerator; $password = PasswordGenerator::generatePassword(); echo "Generated Password: $password" . PHP_EOL;
You can customize the length and inclusion of special characters by providing optional arguments:
$password = PasswordGenerator::generatePassword(12, false); echo "Generated Password (without special chars): $password" . PHP_EOL;
Generating a Passcode
To generate a passcode consisting of only digits, you can use the PasswordGenerator::generatePasscode()
method. By default, it generates a passcode with a length of 6 digits.
$passcode = PasswordGenerator::generatePasscode(); echo "Generated Passcode: $passcode" . PHP_EOL;
You can customize the length of the passcode by providing an optional argument:
$passcode = PasswordGenerator::generatePasscode(8); echo "Generated Passcode (8 digits): $passcode" . PHP_EOL;
Contributing
Contributions are welcome! If you find any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request.
License
This package is open-source software licensed under the MIT license.
Credits
Secure Password Generator was developed by Uriel Wilson.