Skip to content

Installation

tilttek/player-knowledge
composer require tilttek/player-knowledge

The package needs PHP 8.5 or later, and nothing else.

An application gives Knowledge:

  • a Contract\KnowledgeStoreInterface that keeps the secrets and their revelations in its database;
  • a Contract\KnowledgeObserverInterface, to send its messages, or nothing.

The service keeps no state between calls, so one instance serves every request of a long-running worker. A KnowledgeSnapshot belongs to one page: it is read at the start of a request and dropped with it, never kept in a service.

The calls that date a revelation take the moment as a DateTimeImmutable: the application reads it from its clock.

Store\InMemoryKnowledgeStore keeps the secrets and revelations in memory, for tests.