PHPackages                             zeraphie/passwordgen - 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. zeraphie/passwordgen

ActiveLibrary

zeraphie/passwordgen
====================

A simple password generation class

1.5.3(8y ago)0671MITJavaScript

Since Aug 12Pushed 8y ago1 watchersCompare

[ Source](https://github.com/zeraphie/passwordGen)[ Packagist](https://packagist.org/packages/zeraphie/passwordgen)[ RSS](/packages/zeraphie-passwordgen/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (1)Versions (16)Used By (0)

PasswordGen
===========

[](#passwordgen)

A simple class for cryptographically strong secure password generation

Installation - Composer
-----------------------

[](#installation---composer)

This class is available as a package using composer, just run

```
composer require zeraphie/passwordgen
```

### Javascript

[](#javascript)

This also comes as an bower package written in javascript, compiled with gulp as it uses ES2015 for a class structure and thusly has almost exactly the same usage

To install it, run

```
bower install passwordgen
```

Usage
-----

[](#usage)

### Setup

[](#setup)

#### PHP

[](#php)

```
// Require the autoloader
require_once __DIR__ . '/../vendor/autoload.php';

use PasswordGen\PasswordGen;
$passwordGen = new PasswordGen();
```

#### Javascript

[](#javascript-1)

Simply add the [build/master.js](build/master.js) file to your build tool or add the file directly into your html and it will be ready to be used as below

### Basic

[](#basic)

#### PHP

[](#php-1)

```
echo $passwordGen->password();
```

#### JavaScript

[](#javascript-2)

```
console.log(new PasswordGen().password);
```

### Changing the length

[](#changing-the-length)

#### PHP

[](#php-2)

```
echo $passwordGen->setLength(32)->password();
```

#### JavaScript

[](#javascript-3)

```
console.log(new PasswordGen().setLength(32).password);
```

### Changing the keyspace

[](#changing-the-keyspace)

#### PHP

[](#php-3)

```
echo $passwordGen->setKeyspace('abcdefghijklmnopqrstuvwxyz')->password();
```

#### JavaScript

[](#javascript-4)

```
console.log(new PasswordGen().setKeyspace('abcdefghijklmnopqrstuvwxyz').password);
```

### Generating a keyspace

[](#generating-a-keyspace)

#### PHP

[](#php-4)

```
echo $passwordGen->generateKeyspace('lunsw')->password();
```

#### JavaScript

[](#javascript-5)

```
console.log(new PasswordGen().generateKeyspace('lunsw').password);
```

### Changing length and generating keyspace

[](#changing-length-and-generating-keyspace)

#### PHP

[](#php-5)

```
echo $passwordGen->setLength(32)->generateKeyspace('lunsw')->password();
```

#### JavaScript

[](#javascript-6)

```
console.log(new PasswordGen().setLength(32).generateKeyspace('lunsw').password);
```

Note: The two setters are independent of each other so don't need to be in order Note 2: Since the javascript version utilizes static getters, you can simply use (as an example to see the character sets used in the generator) `PasswordGen.CHARACTERSETS` in order to see what the properties of the class are. You can also use `PasswordGen.arrayKeySearch(needles, haystack)` and `PasswordGen.randomInteger(min, max)`

Character Groups
----------------

[](#character-groups)

GroupVariableLetterLOWERCASELETTERS'abcdefghijklmnopqrstuvwxyz'lUPPERCASELETTERS'ABCDEFGHIJKLMNOPQRSTUVWXYZ'uNUMBERS'1234567890'nSPECIALCHARACTERS'!@#$%&amp;\*?,./|\[\]{}()'sWHITESPACE' 'w

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 69.2% 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 ~27 days

Recently: every ~82 days

Total

14

Last Release

3209d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ea6d9b4d7c6f36ce4cbdd8204c93dc86b3ba4f29d61bc210314365fc89572d3d?d=identicon)[zeraphie](/maintainers/zeraphie)

---

Top Contributors

[![lopeax](https://avatars.githubusercontent.com/u/26488873?v=4)](https://github.com/lopeax "lopeax (9 commits)")[![zeraphie](https://avatars.githubusercontent.com/u/7521531?v=4)](https://github.com/zeraphie "zeraphie (4 commits)")

---

Tags

composercryptographiccryptographyjavascriptkeyspacepasswordpassword-generatorpasswordgenphprandompseudorandompasswordgeneration

### Embed Badge

![Health badge](/badges/zeraphie-passwordgen/health.svg)

```
[![Health](https://phpackages.com/badges/zeraphie-passwordgen/health.svg)](https://phpackages.com/packages/zeraphie-passwordgen)
```

###  Alternatives

[paragonie/random_compat

PHP 5.x polyfill for random\_bytes() and random\_int() from PHP 7

8.2k655.0M405](/packages/paragonie-random-compat)[passwordlib/passwordlib

A Password Hashing Library

377220.6k6](/packages/passwordlib-passwordlib)[genphrase/genphrase

Secure passphrase generator for PHP applications

118302.5k4](/packages/genphrase-genphrase)[paragonie/random-lib

A Library For Generating Secure Random Numbers

703.3M26](/packages/paragonie-random-lib)[yiisoft/security

Security utilities

43451.3k6](/packages/yiisoft-security)[delight-im/random

The most convenient way to securely generate anything random in PHP

2345.4k](/packages/delight-im-random)

PHPackages © 2026

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