amneale / dictionary
PHP library for loading and reading collections of strings
v1.1.0
2022-05-31 09:19 UTC
Requires
- php: ^7.4 || ^8.0
- ext-json: *
Requires (Dev)
- phpspec/phpspec: ^7.2
- webmozart/assert: ^1.9.1
README
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