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
Requires
- php: ^8.3
Requires (Dev)
- laravel/pint: ^1.25
- phpunit/phpunit: ^11.0
- rector/rector: ^2.2
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.
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.
| Class | Comment | Word lenghth | Example |
|---|---|---|---|
| WordList\En | all words | 4-6 | have, that |
| WordList\En\Nouns | nouns | 4-6 | time, year |
| WordList\En\Verbs | verbs | 4-6 | have, would |
| WordList\En\Adjectives | adjectives | 4-8 | other, good |
German
List of 2048 most frequently used German words (source). Words with diacritic letters (ä, ö, ü) and eszett (ß) excluded.
| Class | Comment | Word lenghth | Example |
|---|---|---|---|
| WordList\De | all words | 4-6 | sich, nicht |
Security
Library uses CSPRNG for random number generation.
