chriscutts/dice-manager

A package to manage and roll a set of dice then fetch the results

v0.0.2 2022-06-14 22:13 UTC

This package is auto-updated.

Last update: 2024-05-15 02:54:02 UTC


README

A composer project to provide dice management

Description

A small package to be used for building a collection of dice, rolling them and then getting the results.

Installation

composer require chriscutts/dice-manager

Usage

Examples:

Create a manager

When creating the manager you can specify the quantity of dice and the number of sides in the first argument, or provide them seperately.

$manager = new DiceManager('2D6');

$manager = new DiceManager(2, 6);

Roll the dice

$manager->roll();

Get the combined total of the rolled dice

$manager->getTotal();

Get the rolled dice

$dice = $manager->getDice();

Loop through the dice and get the results

foreach ($dice as $die) {
    echo $die->getResult();
}