1. Go to this page and download the library: Download zero-config/d library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
zero-config / d example snippets
use ZeroConfig\D\RollFactory;
use ZeroConfig\D\DieFactory;
use ZeroConfig\D\Interpreter;
use HylianShield\NumberGenerator\NumberGeneratorInterface;
/** @var NumberGeneratorInterface $myCustomNumberGenerator */
$interpreter = new Interpreter(
new DieFactory(
new RollFactory(),
$myCustomNumberGenerator
)
);
$dice = $interpreter->interpretDice('2d20+10');
$total = $dice->getModifier();
foreach ($dice->roll() as $roll) {
$total += $roll->getValue();
}
echo $total;