tilttek / reading-quests
Reward reading that really happened: quests and yearly goals counted from how far each reader got in a book, in pages or minutes, never from screen time.
Requires
- php: >=8.5
- phil/reading-progress: ^0.1@dev
- phil/resource: ^0.1@dev
- psr/clock: ^1.0
- tilttek/activity: ^0.1@dev
- tilttek/quests: ^0.3@dev
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-12-03 01:33:34 UTC
README
Reading quests and yearly goals from how far each reader got in a book, in pages or minutes, never from time spent watching the screen.
tilttek/reading-quests is a plain PHP library that connects phil/reading-progress, which measures how far a reader
got in a long text, to tilttek/quests, which turns what members do into quests accomplished. Each step of reading
becomes activities of tilttek/activity — a book started, pages or minutes read, a book finished — that a quest, a
yearly goal or a badge counts.
- Pages or minutes, at the site's choice: printed pages, or the length of the text at a reading speed; the amount follows the furthest percent read, and a complete reading counts the whole book.
- Never the screen: nothing is counted from the time a page stays open; going back to reread gains nothing; a chapter read offline counts once its position arrives.
- Counted once: every activity has an idempotency key, so a retried request or two tabs count nothing twice; a book read again counts again under its own reading number.
- Thematic challenges: books carry facts — a game system, a genre, where the author comes from, a rules supplement — and quest steps select books by them: finish three books by local authors, read 300 pages of supplements.
- Yearly goals that can change: books finished or pages read in a calendar year, in the site's timezone, with an even pace for the reader alone; raising or lowering the target loses nothing.
- Nothing kept: the library stores nothing of a reader and reads no name, account or text; immutable values and stateless services serve any number of readers in one long-running worker.
Status
| Part | State |
|---|---|
| Books, shelves and their plain-value form | Implemented and tested, fuzzed |
| Measures in pages and minutes | Implemented and tested |
| Activities of a step of reading, recorder | Implemented and tested |
| Quest steps | Implemented and tested |
| Yearly goals | Implemented and tested |
tilttek/reading-quests-bundle: the Symfony bundle, readings and goals in the database, the erasure of a reader |
Implemented and tested |
Documentation
| Document | What it covers |
|---|---|
| Installation | Requirements, installing, a first reading quest. |
| Recording reading | Books, measures, the activities, their keys, reading again, the recorder. |
| Quests | Reading steps, their configuration and thematic challenges. |
| Yearly goals | A reader's goal for a year, the pace, changing the target. |
| Extension points | What an application may replace or add, and what is stable. |
| Exceptions | The exceptions and their messages. |
| Testing | The tests, the fuzz target and the benchmark. |
| Reference | Every public type, with its role. |
Quick start
composer require tilttek/reading-quests
use Tilttek\ReadingQuests\InMemoryBookShelf; use Tilttek\ReadingQuests\ReadingActivities; use Tilttek\ReadingQuests\ReadingMeasure; use Tilttek\ReadingQuests\ReadingRecorder; use Tilttek\ReadingQuests\ReadingSteps; use Tilttek\ReadingQuests\ReadingUnit; $shelf = InMemoryBookShelf::fromArray(['core-rulebook' => ['pages' => 320, 'facts' => ['system' => 'dnd5e']]]); $recorder = new ReadingRecorder($journal, $shelf, new ReadingActivities(ReadingMeasure::pages())); // The page reports the block in view; the progress is the one stored for this reader and book. $result = $recorder->record($before, $document, 'member:44', $position, $clock->now()); $row->progress = $result->update->progress->toString(); // A quest step of tilttek/quests: read 300 pages of the system's books. ReadingSteps::read('read-300-pages', 300, ReadingUnit::Pages, ['system' => 'dnd5e']);
Requirements
PHP 8.5 or later, with the mbstring extension.
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.