Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/trismegiste/rpg-name-generator
Library for generating random names (for table-top roleplaying games)
https://github.com/trismegiste/rpg-name-generator
Last synced: about 1 month ago
JSON representation
Library for generating random names (for table-top roleplaying games)
- Host: GitHub
- URL: https://github.com/trismegiste/rpg-name-generator
- Owner: Trismegiste
- Created: 2021-11-24T13:48:27.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-11-23T16:50:20.000Z (about 1 year ago)
- Last Synced: 2024-04-25T18:20:19.215Z (8 months ago)
- Language: PHP
- Size: 133 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# RPG-Name-Generator
The RPG character name generator library is designed to create list of random names used for table-top role-playing games.This library was extracted from the website [PHP-Character-Name-Generator](https://github.com/mark-tasaka/PHP-Character-Name-Generator)
from [Mark Tasaka](https://github.com/mark-tasaka) after a heavy overhaul and with the help of
[nikic/PHP-Parser](https://github.com/nikic/PHP-Parser)
(by the way, this tool is awesome)This library is fully tested with PhpUnit, 100% code coverage.
# Install
With Composer :
```bash
composer require trismegiste/rpg-name-generator
```# Usage
See phpunit tests for how to use this library :
```php
$repo = new FileRepository();
print_r($repo->getSurnameListFor('japanese'));
print_r($repo->getGivenNameListFor('female', 'japanese'));
```RandomizerDecorator class is a decorator for adding randomizing capabilities :
```php
$repo = new RandomizerDecorator(new FileRepository());
print_r($repo->getSurnameListFor('random')); // gets the list of surnames from a random language
echo $repo->getRandomGivenNameFor('female', 'chinese'); // picks one random chinese female given name
echo $repo->getRandomSurnameFor('french'); // picks one random french surname
echo $repo->getRandomSurnameFor('random'); // picks one random surname from a random language (full random)
```# Test
With PhpUnit :
```bash
vendor/bin/phpunit
```# Code coverage
With phpdbg :
```bash
phpdbg -qrr vendor/bin/phpunit
firefox doc/coverage/index.html
```