A campaign's journal in a Symfony application: entries and their blocks kept in the database at a version, their events dispatched, a member's entries exported and erased.
tilttek/journal-bundle integrates tilttek/journal with Symfony. It keeps the entries of the journals — session
summaries, characters' journals, solo play, what players remember of the games they recorded — and their blocks in two
tables on a Doctrine DBAL connection, added to the schema the ORM generates so that the application's migrations create
them. Each change is written at the version it was made on, compared in the UPDATE itself: two writers at once are
told apart, and the second one reads the entry again. A journal is read in two queries whatever its size.
The bundle defines Journal on the application's services: the store of the campaigns' secrets of
tilttek/player-knowledge, which hides each block from the readers who do not know it, the directory that links the
names of the blocks to pages, and the source that sums up what happened in a session. The events reach the
application's event dispatcher, by identifiers only. MarkdownExport writes its links to pages where the configuration
says. A member who leaves is exported and erased through phil/privacy-bundle, the published session summaries kept
under a pseudonym when the application asks for it.
It is for a Symfony application whose tables keep a journal — the story of a campaign as each player may read it.
It requires Symfony's DependencyInjection and Config, Doctrine DBAL, the PSR event dispatcher, tilttek/journal and
tilttek/player-knowledge. The ORM and phil/privacy-bundle are optional: the schema listener and the privacy module
are registered only when they are installed.
The design follows the other bundles of the monorepo: an AbstractBundle with its configuration, services declared by
JournalServices, a DBAL store and the library's memory store for tests, tables added by a schema listener.
| Part | State |
|---|---|
Configuration tilttek_journal: store, connection, secrets, pages, session events, Markdown links, member erasure |
Implemented and tested |
DbalJournalStore, with its two tables, on SQLite, PostgreSQL, MySQL and MariaDB schemas |
Implemented and tested |
| The tables in the schema the ORM generates, for the migrations | Implemented and tested |
| The events through the application's dispatcher | Implemented and tested |
Export and erasure of a member for phil/privacy-bundle |
Implemented and tested |
| The DBAL store against MySQL and PostgreSQL servers | Not started |
| Pages, forms and the editor of the entries | Not started |
| Document | What it covers |
|---|---|
| Installation | Requirements, enabling the bundle, the migration, the secrets of the campaigns. |
| Configuration | Every key of tilttek_journal, with its default. |
| The entries in the database | The tables, the indexes, writers at once, what reading costs. |
| Events | Listening to the journal's events. |
| Privacy | The export and the erasure of a member, and what they leave. |
| Extension points | The services, aliases and tags the application uses. |
| Testing | The bundle's tests, its benchmark, and testing an application. |
| Reference | Every class of the bundle, with its role. |
composer require tilttek/journal-bundle# config/packages/tilttek_journal.yaml
tilttek_journal:
knowledge_store: App\Knowledge\DoctrineKnowledgeStore
pages_service: App\Wiki\WikiPagesuse Tilttek\Journal\Block;
use Tilttek\Journal\Genre;
use Tilttek\Journal\Journal;
final readonly class WriteTheSummary
{
public function __construct(private Journal $journal) {}
public function __invoke(string $id, string $campaign, string $session, string $member): void
{
$draft = $this->journal->draft($id, $campaign, Genre::Session, $member, 'The siege of the mill', $session);
$this->journal->write($id, $draft->version, [new Block('b1', 'We held [[The Mill|the mill]] until dawn.')]);
}
}Then bin/console doctrine:migrations:diff writes the migration of the journal's tables.
PHP 8.5 or later, Symfony 8.2, Doctrine DBAL 4.6.
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.
MIT, © Philippe Gamache, doing business as Le Gnome Archiviste; a Tilttek project. See LICENSE.