https://github.com/ph-7/passcode-password-generator
🤗 A simple, secure & efficient way to generate passcodes and passwords for your PHP application 🔐
https://github.com/ph-7/passcode-password-generator
cryptographically-secure cryptographically-secure-random cryptography passcode passcode-generator passcode-generator-php password-generator password-generator-php php random-passcode random-passcode-generator random-password random-password-generator
Last synced: 2 months ago
JSON representation
🤗 A simple, secure & efficient way to generate passcodes and passwords for your PHP application 🔐
- Host: GitHub
- URL: https://github.com/ph-7/passcode-password-generator
- Owner: pH-7
- License: mit
- Created: 2021-09-26T10:20:53.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-01T07:35:28.000Z (3 months ago)
- Last Synced: 2025-03-16T06:35:47.671Z (2 months ago)
- Topics: cryptographically-secure, cryptographically-secure-random, cryptography, passcode, passcode-generator, passcode-generator-php, password-generator, password-generator-php, php, random-passcode, random-passcode-generator, random-password, random-password-generator
- Language: PHP
- Homepage: https://packagist.org/packages/ph-7/passcode-password-generator
- Size: 56.6 KB
- Stars: 10
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# PHP Passcodes & Passwords Generator
## 📄 Description
*A simple, secure & clean way to generate random **passcodes** and **passwords** 🔑*
The library generates cryptographically secure random passwords and passcodes.
[](https://ko-fi.com/phenry)
## 🛠 Server Requirement
* [PHP 7.3](https://php.net/releases/7_3_0.php) and higher 🚀
## 🛠 Installation (with Composer)
```bash
composer require ph-7/passcode-password-generator
```## 📄 Usage
### For Passcodes
```php
use PH7\Generator\Passcode;echo Passcode::generate(10); // Generate a 10-length passcode
````By default, without argument, the function will generate a 6-character passcode.
```php
use PH7\Generator\Passcode;// By default, it generates a 6 length passcode
echo Passcode::generate();// You can use the public `Passcode::DEFAULT_LENGTH` const, whcih also gives a 6-length passcode
echo Passcode::generate(Passcode::DEFAULT_LENGTH);
````### For Passwords
```php
use PH7\Generator\Password;echo Password::generate(16); // Generate a 16-length password
````By default, generated passwords will contain special characters. You can disable them by mentioning the second argument to `false`
```php
use PH7\Generator\Password;// The password won't contain any special characters such as -, _, ~, |, %, ^, !, $, #, @, and ?
echo Password::generate(Password::DEFAULT_LENGTH, false);
````Without argument, the function will generate a 12-character password.
```php
use PH7\Generator\Password;// By default, it generates a 12-length password
echo Password::generate();// Password::DEFAULT_LENGTH also gives a 12-length password
echo Password::generate(Password::DEFAULT_LENGTH);
````## 😋 Who cooked it?
[](https://ph7.me "Pierre-Henry Soria personal website")
[![@phenrysay][x-image]](https://x.com/phenrysay) [![pH-7][github-image]](https://github.com/pH-7) [![YouTube Tech Videos][youtube-icon]](https://www.youtube.com/@pH7Programming "My YouTube Tech Channel")
**[Pierre-Henry Soria](https://ph7.me)**, a highly passionate, zen & pragmatic software engineer 😊
☕️ Would like to help? **[Offer me a coffee](https://ko-fi.com/phenry)**, and boost the maintenance of this library! 💪
## ⚖️ License
**PHP Passcode/Password Generator** is generously distributed under the *[MIT](https://opensource.org/licenses/MIT)* 🎉
[x-image]: https://img.shields.io/badge/x-000000?style=for-the-badge&logo=x&logoColor=white
[github-image]: https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white
[youtube-icon]: https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white