Skip to content

Installation

tilttek/character-sheet
composer require tilttek/character-sheet

The package needs PHP 8.5 or later and tilttek/rpg-systems, whose game systems give the sheets their attributes and bounds.

An application gives CharacterSheets:

  • a Contract\SheetStore that keeps the sheets in its database;
  • a Contract\RuleBook that gives the SheetRules of each system it knows, such as Rules\StaticRuleBook, built once from the systems tilttek/rpg-systems reads;
  • a Contract\SheetObserver, to send its messages, or nothing.

The service keeps no state between calls, so one instance serves every request of a long-running worker. The rules hold the system and its parsed formulas: build them once, at warm-up, rather than at each request.

Store\InMemorySheetStore keeps the sheets in memory, for tests.