alwayscurious/wonderwords
Composer 安装命令:
composer require alwayscurious/wonderwords
包简介
A wonderful way to generate random words, phrases, and sentences from curated word lists.
README 文档
README
A wonderful way to generate random words, phrases, and sentences from curated word lists.
Installation
composer require alwayscurious/wonderwords
Usage
Basic Usage
use AlwaysCurious\WonderWords\WonderWords; $ww = new WonderWords(); // Generate a random word $ww->word(); // "phoenix" // Generate a random phrase (adjective + noun) $ww->phrase(); // "blazing phoenix" // Generate a random sentence $ww->sentence(); // "The fierce dragon roars mightily." // Generate a slug $ww->slug(); // "crimson-falcon" $ww->slug('_'); // "crimson_falcon"
Multiple Results
$ww->words('nouns', 3); // ["phoenix", "glacier", "storm"] $ww->phrases(5); // ["bold raven", "cosmic ember", ...] $ww->sentences(3); // ["The swift falcon soars boldly.", ...]
Custom Combinations
use AlwaysCurious\WonderWords\WordList; // Combine any categories in any order $ww->combine([WordList::ADJECTIVES, WordList::NOUNS, WordList::VERBS]); // "golden eagle soars" // Use a custom separator $ww->separator('-')->phrase(); // "blazing-phoenix"
Word Categories
Built-in categories: adjectives, nouns, verbs, adverbs
$ww->word(WordList::ADJECTIVES); // "fierce" $ww->word(WordList::NOUNS); // "dragon" $ww->word(WordList::VERBS); // "roars" $ww->word(WordList::ADVERBS); // "mightily"
Custom Word Lists
$ww = new WonderWords(); // Replace a built-in category $ww->wordList()->setCategory('colors', ['red', 'blue', 'green']); // Add words to an existing category $ww->wordList()->addWords(WordList::NOUNS, ['spaceship', 'robot']); // Use your custom category $ww->word('colors'); // "blue"
Credits
This package is a PHP port inspired by the Python WonderWords library by mrmaxguns.
License
MIT
统计信息
- 总下载量: 954
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-07