amneale/dictionary

PHP library for loading and reading collections of strings

v1.1.0 2022-05-31 09:19 UTC

This package is auto-updated.

Last update: 2024-11-06 20:52:36 UTC


README

Build Status Code Quality

Install

Via Composer

$ composer require amneale/dictionary

Usage

Creating a dictionary from strings, and reading the content a random, shuffled order:

$reader = new ShuffleReader();
$dictionary = new Dictionary('foo', 'bar', 'baz');

for ($i = 0; $i < count($dictionary); ++$i) {
    echo $reader->read($dictionary) . "\n";
}

Loading a dictionary from a file:

$dictionary = Dictionary\Loader\SimpleFileLoader::fromFile('/foo/bar/baz.txt');

Loading a dictionary from a CSV file:

$dictionary = Dictionary\Loader\SimpleFileLoader::fromFile('/foo/bar/baz.csv', ',');

Testing

To run automatic code-style fixer

$ make fmt

To run all tests

$ make test