tilttek / spotlight
Share play time fairly at a table: a discreet count, for the game master by default, of who had the scene and since when, and who waits a turn.
Requires
- php: >=8.5
- psr/clock: ^1.0
Requires (Dev)
- phpunit/phpunit: ^13.4
- symfony/clock: ^8.2
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-30 02:53:45 UTC
README
Play time shared among a table's players, and who is waiting for their turn.
tilttek/spotlight keeps a discreet count of the scene at a game table: who holds it now, how long each player held it, how long since their last scene, and who waits with a raised hand. The game master reads it, alone by default, to share the play time; the table sees who holds the scene and the queue.
- The scene. Given to a player, taken back for a scene of the whole group, passed to the next player who should have it: the first raised hand, else the player who held it the least, who has waited the longest at equal time.
- The queue. A player raises a hand in one gesture and waits first come, first served; giving them the scene takes them out of it.
- The shares. Each player's time, scenes and share of the table's time, and whether they are behind: below a part of the fair share once the table has counted enough time — half of it after ten minutes, by default.
- Pauses and seats. The table pauses the count and resumes it; a player joins in the last seat or leaves with their count; a closed table changes no more.
- Who sees what. The counts are for the game master by default; a table that wants them shows them to everyone.
The service reads the time from a PSR-20 clock and from nothing else; it never listens to the players. The facts of a table — opened, a scene given or ended, a hand raised or lowered, paused, resumed, a player joined or left, closed — go to an observer, each once, by identifiers only.
It is a plain PHP library: one service, value objects, ports and a store kept in memory for tests.
Status
| Part | State |
|---|---|
Table, PlayerShare, Visibility, FairnessPolicy: a table and its players' counts, bounded and checked |
Implemented and tested |
Spotlight: open, give, give next, release, raise and lower a hand, pause, resume, join, leave, close |
Implemented and tested |
View\SpotlightView and View\PlayerSpotlight: the shares for the game master, and what the table sees |
Implemented and tested |
Store\InMemoryTableStore: the store of the tests |
Implemented and tested |
| A Symfony bundle: the Doctrine store, Mercure and a Stimulus display | Not started |
Documentation
| Document | What it covers |
|---|---|
| Installation | Requirements, installing and wiring. |
| Scenes and shares | The scene, the queue, the next player, pauses, seats, closing, the shares and who sees them. |
| Extension points | The store, the observer and its events, the clock, and who may do what. |
| Exceptions | SpotlightException and its exceptions. |
| Testing | The library's tests and its benchmarks. |
| Reference | Every type of the library, with its role. |
Quick start
use Tilttek\Spotlight\Spotlight; $spotlight = new Spotlight($store, $clock, $observer); // your TableStore, a PSR-20 clock, an observer $spotlight->open('table-4', ['player-1', 'player-2', 'player-3']); $spotlight->give('table-4', 'player-1'); // player 1 has the scene $spotlight->raiseHand('table-4', 'player-3'); // player 3 waits $spotlight->giveNext('table-4'); // the scene goes to player 3 $spotlight->release('table-4'); // a scene of the whole group $view = $spotlight->view('table-4'); $view->toArray(); // for the game master: times, shares, who is behind $view->toTableArray(); // for the table: who holds the scene, and the queue
Requirements
PHP 8.5 or later, with psr/clock.
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.