plusforta/password-generator

PHP library for generating easy to remember but hard to guess passwords

Installs: 65

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Forks: 0

pkg:composer/plusforta/password-generator

v1.1.1 2025-11-24 13:18 UTC

This package is auto-updated.

Last update: 2025-11-24 12:24:04 UTC


README

A flexible and scriptable password generator which generates strong passphrases, inspired by XKCD Comic 936. Generated passwords easy to remember, but hard to guess passwords.

XKCD Password Strength

Note: This is a modernized fork of the original password-generator by 27cm/KarelWintersky, updated for PHP 8.3+ compatibility.

Installing

With Composer:

$ composer require plusforta/password-generator

Basic usage

Library generates phrases from frequently used words:

  • English phrases (example "throat-fast-only-idea")
  • German phrases (example "laut-welt-ganze-liter")

Generate password with default length (4 words) and default separator (dash).

use Plusforta\Password\Generator;

// Generate English password (default: 4 words with dash separator)
echo Generator::generateEn();
// => "throat-fast-only-idea"

// Generate German password (default: 4 words with dash separator)
echo Generator::generateDe();
// => "laut-welt-ganze-liter"

// Custom length
echo Generator::generateEn(6);
// => "ritual-error-raise-arab-tail-happy"

// Custom separator (space)
echo Generator::generateEn(4, ' ');
// => "throat fast only idea"

// Custom separator (underscore)
echo Generator::generateDe(4, '_');
// => "laut_welt_ganze_liter"

Word lists

English

List of 2048 most frequently used English words.

ClassCommentWord lenghthExample
WordList\Enall words4-6have, that
WordList\En\Nounsnouns4-6time, year
WordList\En\Verbsverbs4-6have, would
WordList\En\Adjectivesadjectives4-8other, good

German

List of 2048 most frequently used German words (source). Words with diacritic letters (ä, ö, ü) and eszett (ß) excluded.

ClassCommentWord lenghthExample
WordList\Deall words4-6sich, nicht

Security

Library uses CSPRNG for random number generation.