https://github.com/natanael-aguiar/secure-password-generator
This PHP package allows you to generate secure passwords with configurable options, including uppercase letters, lowercase letters, numbers, and special characters.
https://github.com/natanael-aguiar/secure-password-generator
password password-generator php phpstan phpunit security
Last synced: 2 months ago
JSON representation
This PHP package allows you to generate secure passwords with configurable options, including uppercase letters, lowercase letters, numbers, and special characters.
- Host: GitHub
- URL: https://github.com/natanael-aguiar/secure-password-generator
- Owner: natanael-aguiar
- License: other
- Created: 2023-10-13T16:34:23.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-06-05T14:32:55.000Z (5 months ago)
- Last Synced: 2025-07-06T00:42:37.525Z (4 months ago)
- Topics: password, password-generator, php, phpstan, phpunit, security
- Language: PHP
- Homepage: https://packagist.org/packages/natanael-aguiar/secure-password-generator
- Size: 34.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
Awesome Lists containing this project
README
# Secure Password Generator PHP Package
[](https://github.com/natanael-aguiar/secure-password-generator/actions/workflows/ci.yml)
[](https://packagist.org/packages/natanael-aguiar/secure-password-generator)
[](LICENSE)
This PHP package allows you to generate secure passwords with configurable options, including uppercase letters, lowercase letters, numbers, and special characters.
## Installation
You can install this package using Composer:
```bash
composer require natanael-aguiar/secure-password-generator
```
## Usage
```php
allowLowercase(true);
$generator->allowUppercase(true);
$generator->allowNumbers(true);
$generator->allowSpecialCharacters(true);
// Generate a secure password of length 8
try {
$password = $generator->generatePassword(8);
echo($password);
} catch (Exception $e) {
echo($e);
}
```
## Documentation
### `SecurePasswordGenerator` (Main Class)
#### Methods
- `allowLowercase(bool $allow): void` - Enables or disables lowercase letters in the password.
- `allowUppercase(bool $allow): void` - Enables or disables uppercase letters in the password.
- `allowNumbers(bool $allow): void` - Enables or disables numbers in the password.
- `allowSpecialCharacters(bool $allow): void` - Enables or disables special characters in the password.
- `generatePassword(int $length = 12): string` - Generates a secure password with the specified length.
## Contributing
See the [CONTRIBUTING.md](CONTRIBUTING.md) file for details on the contribution process.
## Code of Conduct
This project adopts the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md).
## Running Tests, Lint, and Static Analysis
- **Tests:**
```bash
vendor/bin/phpunit
```
- **Lint (PSR-12):**
```bash
vendor/bin/php-cs-fixer fix --dry-run --diff --allow-risky=yes
```
- **Static Analysis:**
```bash
vendor/bin/phpstan analyse
```
## Contribution
Contributions are welcome! Please open an issue or submit a pull request if you want to contribute.