承接 plusforta/password-generator 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

plusforta/password-generator

Composer 安装命令:

composer require plusforta/password-generator

包简介

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

README 文档

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"

Exporting word lists

You can access and export the complete word list from any WordList class:

use Plusforta\Password\WordList\En;
use Plusforta\Password\WordList\De;

// Get all words from English word list
$en = new En();
$allWords = $en->getWords();
// => array of 2048 English words

// Get all words from German word list
$de = new De();
$allWords = $de->getWords();
// => array of 2048 German words

// Filter words by prefix (case-insensitive)
$wordsStartingWithAn = $en->getWords('an');
// => array of words starting with "an" (e.g., "and", "animal", "answer")

// Uppercase prefix works the same way
$sameWords = $en->getWords('AN');
// => same result as lowercase "an"

// Export to JSON
echo json_encode($en->getWords());

// Export words starting with specific prefix
echo json_encode($en->getWords('pre'));

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.

统计信息

  • 总下载量: 2.06k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固