PHPackages                             ph7software/secure-password-generator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. ph7software/secure-password-generator

ActiveLibrary[Security](/categories/security)

ph7software/secure-password-generator
=====================================

A simple way to generate random cryptographically secure passwords for PHP 5.6+

1.3.1(3y ago)39501MITPHPPHP &gt;=5.6.0

Since Sep 28Pushed 3y agoCompare

[ Source](https://github.com/pH7Software/Secure-Password-Generator)[ Packagist](https://packagist.org/packages/ph7software/secure-password-generator)[ Docs](https://ph7.me)[ Fund](https://www.buymeacoffee.com/ph7cms)[ GitHub Sponsors](https://github.com/pH-7)[ RSS](/packages/ph7software-secure-password-generator/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (6)Dependencies (2)Versions (7)Used By (0)

PHP Password Generator
======================

[](#php-password-generator)

📄 Description
-------------

[](#-description)

A simple way to generate random cryptographically secure passwords.

🛠 Installation (with Composer)
------------------------------

[](#-installation-with-composer)

```
composer require ph7software/secure-password-generator
```

🛠 Server Requirement
--------------------

[](#-server-requirement)

- **[PHP 5.6](https://php.net/releases/5_6_0.php)** and higher 🎉

🎮 Usage
-------

[](#-usage)

```
use PH7\Generator\Password;

echo Password::generate(10); // Generate a 10-length password
```

By default, the password will contain special characters. You can disable them by mentioning the second argument to `false`

```
use PH7\Generator\Password;

// The password won't contain any special characters such as -, _, ~, |, %, ^, !, $, #, @, and ?
echo Password::generate(Password::DEFAULT_LENGTH, false);
```

You can use the constant `Password::DEFAULT_LENGTH` which contains `12` as the default value

```
use PH7\Generator\Password;

// By default, it generates a 12-length password
echo Password::generate(Password::DEFAULT_LENGTH);
```

Without argument, the function will also generate a 12-character password.

```
use PH7\Generator\Password;

// By default, it generates a 12-length password
echo Password::generate();
```

😋 Who cooked it?
----------------

[](#-who-cooked-it)

[![Pierre-Henry Soria](https://camo.githubusercontent.com/2e624b95003073bd56ecb43792155201b96f2e1d11bab1218e2215b6238c6ac2/68747470733a2f2f732e67726176617461722e636f6d2f6176617461722f61323130666536313235336334336338363964373165616564306539303134393f733d323030)](https://ph7.me "Pierre-Henry Soria personal website")

[![@phenrysay](https://camo.githubusercontent.com/9ebce40b5dc8ca37584b018fd5b5941319d135117ef1fb2330f4aa95877e79f5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f547769747465722d3144413146323f7374796c653d666f722d7468652d6261646765266c6f676f3d74776974746572266c6f676f436f6c6f723d7768697465)](https://twitter.com/phenrysay) [![pH-7](https://camo.githubusercontent.com/4fcd516e2fde608afc9ddd1330de295d23981c27a9b9d695f8abe51f70a1efc5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4769744875622d3130303030303f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562266c6f676f436f6c6f723d7768697465)](https://github.com/pH-7)

**[Pierre-Henry Soria](https://ph7.me)**, a highly passionate, zen &amp; pragmatic software engineer 😊

🤗 Used By...
------------

[](#-used-by)

**[pH7Builder](http://github.com/pH7Software/pH7-Social-Dating-CMS/)** is using this package for generating default passwords to users. ​

⚖️ License
----------

[](#️-license)

**PHP Password Generator** is generously distributed under the *[MIT](https://opensource.org/licenses/MIT)*.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~86 days

Recently: every ~107 days

Total

6

Last Release

1298d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b6d95da236687f1dca4f7d70d60037c70ef217120ea195df23a39a412ba594e0?d=identicon)[ph-7](/maintainers/ph-7)

---

Top Contributors

[![pH-7](https://avatars.githubusercontent.com/u/1325411?v=4)](https://github.com/pH-7 "pH-7 (28 commits)")

---

Tags

passwordpassword-generatorphp-password-generatorphp56securitysimple-password-generatorsecuritycryptographypasswordgeneratorcryptographically securepassword generatorsecure password

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ph7software-secure-password-generator/health.svg)

```
[![Health](https://phpackages.com/badges/ph7software-secure-password-generator/health.svg)](https://phpackages.com/packages/ph7software-secure-password-generator)
```

###  Alternatives

[phpseclib/phpseclib

PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.

5.6k455.2M1.5k](/packages/phpseclib-phpseclib)[defuse/php-encryption

Secure PHP Encryption Library

3.9k170.7M239](/packages/defuse-php-encryption)[ph-7/passcode-password-generator

A simple way to generate random cryptographically secure passcodes and passwords

1225.4k4](/packages/ph-7-passcode-password-generator)[rych/phpass

PHP Password Library: Easy, secure password management for PHP

248837.5k4](/packages/rych-phpass)[bordoni/phpass

Portable PHP password hashing framework

244.6M28](/packages/bordoni-phpass)[nicobleiler/php-passphrase

Passphrase generator with Laravel integration, inspired by Bitwarden. Uses the EFF long word list by default with support for custom wordlists.

476.0k](/packages/nicobleiler-php-passphrase)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
