PHPackages                             lopeax/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. lopeax/passwordgen

Abandoned → [zeraphie/passwordGen](/?search=zeraphie%2FpasswordGen)Library[Utility &amp; Helpers](/categories/utility)

lopeax/passwordgen
==================

A simple password generation class

1.5.3(8y ago)0391MITJavaScript

Since Aug 12Pushed 8y ago1 watchersCompare

[ Source](https://github.com/lopeax/passwordGen)[ Packagist](https://packagist.org/packages/lopeax/passwordgen)[ RSS](/packages/lopeax-passwordgen/feed)WikiDiscussions master Synced today

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

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

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

3255d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7521531?v=4)[Izzy Skye](/maintainers/zeraphie)[@zeraphie](https://github.com/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/lopeax-passwordgen/health.svg)

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

###  Alternatives

[paragonie/random_compat

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

8.2k675.8M425](/packages/paragonie-random-compat)[nette/utils

🛠 Nette Utils: lightweight utilities for string &amp; array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.

2.1k417.9M1.7k](/packages/nette-utils)[ircmaxell/random-lib

A Library For Generating Secure Random Numbers

84031.5M126](/packages/ircmaxell-random-lib)[genphrase/genphrase

Secure passphrase generator for PHP applications

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

A Library For Generating Secure Random Numbers

703.5M26](/packages/paragonie-random-lib)[oat-sa/tao-core

TAO core extension

66140.1k108](/packages/oat-sa-tao-core)

PHPackages © 2026

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