Search by

tilttek / reading-quests-bundle

phil

Count real reading, not screen time: each reader's place in a book kept in Symfony, pages or minutes counted once, yearly goals, export and erasure.

Package info

github.com/TiltTek/reading-quests-bundle

Homepage

Type:symfony-bundle

pkg:composer/tilttek/reading-quests-bundle

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.1.0-alpha 2026-12-02 22:00 UTC

This package is auto-updated.

Last update: 2026-12-03 01:33:42 UTC


README

Run reading quests in your Symfony app: each reader's place in a book stored, pages or minutes counted once, yearly goals kept, all exported and erased.

tilttek/reading-quests-bundle integrates tilttek/reading-quests with Symfony, on the activity journal of tilttek/activity-bundle. It keeps, for each reader and each book, the progress of phil/reading-progress — the place reached, the furthest percent, when the book was finished — in a table on a Doctrine DBAL connection, one row per reading, written at the version it was read at. ReadingTracker records a position in one call: the stored reading read, the activities book.started, book.read and book.finished recorded in the journal, the reading stored, then ReadingStarted and ReadingCompleted handed to the application's event dispatcher. The time is the server's clock, never the browser's, and the same position sent twice counts once.

ReaderGoals keeps each reader's goal for a calendar year — books finished, or pages or minutes read — and reads where they stand from the journal, in the site's timezone; a target changed during the year loses nothing. The books come from the configuration, from a table the application edits, or from the application's own catalogue. A reader who leaves is exported and erased through phil/privacy-bundle.

It is for a Symfony application whose members read long texts — rulebooks, campaign settings, stories — and earn quests and badges for it.

It requires Symfony's DependencyInjection and Config, Doctrine DBAL, the PSR clock and event dispatcher, phil/reading-progress, phil/resource, tilttek/activity-bundle and tilttek/reading-quests. 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 ReadingQuestsServices, repositories on DBAL and in memory for tests, tables added by a schema listener.

Status

Part State
Configuration tilttek_reading_quests: store, connection, measure, completion, timezone, shelf, member erasure Implemented and tested
ReadingTracker: a position recorded, stored at its version, its events dispatched; reading a book again Implemented and tested
ReaderGoals: yearly goals kept and read from the activity journal Implemented and tested
The readings, goals and books on DBAL, with their 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
Export and erasure of a reader for phil/privacy-bundle Implemented and tested
The DBAL repositories against MySQL and PostgreSQL servers Not started
A controller of positions and a component of the goal for the PHIL UX kit Not started

Documentation

Document What it covers
Installation Requirements, enabling the bundle, the verbs of the journal, the migration.
Configuration Every key of tilttek_reading_quests, with its default.
Recording reading ReadingTracker: a position, writers at once, reading a book again.
Yearly goals ReaderGoals: setting, changing and reading a reader's goal.
The readings in the database The tables, the shelf in the database, what a position costs.
Events Listening to the start and the end of a reading.
Privacy The export and the erasure of a reader, 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.

Quick start

composer require tilttek/reading-quests-bundle
# config/packages/tilttek_reading_quests.yaml
tilttek_reading_quests:
    measure: { unit: pages }
    shelf:
        books:
            core-rules: { pages: 320, facts: { system: dnd5e } }
use Phil\ReadingProgress\Document;
use Phil\ReadingProgress\Position;
use Tilttek\ReadingQuestsBundle\Application\ReadingTracker;

final readonly class SaveThePlace
{
    public function __construct(private ReadingTracker $tracker) {}

    public function __invoke(int $member, Document $rulebook, string $block, int $offset): int
    {
        return $this->tracker->record('member:'.$member, $rulebook, new Position($block, $offset))->gained;
    }
}

Then bin/console doctrine:migrations:diff writes the migration of the reading tables.

Requirements

PHP 8.5 or later, Symfony 8.2, Doctrine DBAL 4.6.

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.