Skip to content

tilttek/dice-tower

✅ published

A table's shared dice tower: every roll seen by everyone at the table, in order, as it falls.

tilttek/dice-tower is a Symfony bundle on tilttek/dice-bundle. A roll of the journal of the dice is dropped in a table's tower; the tower keeps where it fell, in a log of its own, and pushes the new entry to a private Mercure topic of the table, which only the viewers the application allows subscribe to. A viewer who was away reads what was missed from the log, by position: nothing is kept in memory between two requests. The entries carry identifiers and the result of the roll, never a person's name. A Twig and Stimulus overlay, drawn with the PHIL UX kit, shows the tower and adds each new roll; relays carry each entry to other channels, through adapters of their own packages.

Status

PartState
The log of the towers, in Doctrine or in memory, its positions given by the databaseImplemented and tested
DiceTower: rolls dropped, entries read in order, missed entries read again, erasure of a rollerImplemented and tested
The private topic of each table on a Mercure hub, and the authorization of its viewersImplemented and tested
The route of the missed entries, for allowed viewers onlyImplemented and tested
dice_tower(), the overlay drawn with the PHIL UX kit and its Stimulus controller, in English and FrenchImplemented and tested
The relays, at once or through a message busImplemented and tested

Documentation

DocumentWhat it covers
InstallationRequirements, registering the bundle, the route, the hub and the recipes of the kit.
ConfigurationEvery key, its default and what it sets.
The tower in PHPRolling and dropping, reading the entries, the payload, privacy and long-running processes.
The overlaydice_tower(), the overlay, its Stimulus controller and its events.
Extension pointsWho may watch a table, relays to other channels, publishers, templates and translations.
TestingThe bundle's tests, and how to test an application that uses a tower.
ReferenceEvery type and service of the bundle.

Quick start

composer require tilttek/dice-tower symfony/mercure-bundle
php bin/console ux:install card --kit=github.com/parler-haut-interagir-librement/ux-kit
// config/bundles.php
return [
    Tilttek\DiceBundle\TilttekDiceBundle::class => ['all' => true],
    Tilttek\DiceTower\TilttekDiceTowerBundle::class => ['all' => true],
];
# config/packages/tilttek_dice_tower.yaml
tilttek_dice_tower:
    table_access: App\Dice\TableMembers

# config/routes/tilttek_dice_tower.yaml
tilttek_dice_tower:
    resource: '@TilttekDiceTowerBundle/config/routes.php'
$tower->roll(ResourceReference::of('table', '7'), '1d20+5', ResourceReference::of('member', '42'));
{{ dice_tower('table:7', {'member:42': 'Aelis'}) }}

Requirements

PHP 8.5 or later, Symfony 8.2, tilttek/dice-bundle, Doctrine ORM for the log and a Mercure hub for the live entries; Twig, Symfony UX and the recipes of the PHIL UX kit for the overlay.

Contributing

Contributions are welcome on the PHIL monorepo: read the contribution guide and the code of conduct. Report a vulnerability privately, as the security policy explains, never in a public issue.

License

MIT, © Philippe Gamache, doing business as Le Gnome Archiviste; a Tilttek project. See LICENSE.