Download the PHP package phil/spaced-repetition without Composer
On this page you can find all versions of the php package phil/spaced-repetition. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download phil/spaced-repetition
More information about phil/spaced-repetition
Files in phil/spaced-repetition
Package spaced-repetition
Short Description Schedule reviews so learners remember more while studying less: the FSRS-6 algorithm, learning steps, a review queue and review logs to replay.
License MIT
Homepage https://ph-il.ca
Informations about the package spaced-repetition
phil/spaced-repetition
Schedule reviews so learners remember more while studying less: the FSRS-6 algorithm, learning steps, a review queue and review logs to replay.
phil/spaced-repetition is a plain PHP library without dependencies. It decides when a learner should see a card again: right before they would forget it. A course, a vocabulary deck, a set of rules to learn or the questions of a quiz become cards; the learner answers Again, Hard, Good or Easy; the scheduler gives the card its next date and the log of the review.
- FSRS-6: the Free Spaced Repetition Scheduler, from its published formulas. Each card has a stability — the days after which recall falls to 90 % — and a difficulty from 1 to 10; each answer moves both. The published default weights serve a learner nobody has optimised for yet; weights trained on a learner's own logs replace them, and nineteen-weight FSRS-5 vectors are read too.
- A retention to aim for: the learner, or the course, picks the probability of recall at which a card falls due, from 70 % to 99 %; a lower retention means longer intervals and fewer reviews.
- Learning and relearning steps: a new or forgotten card comes back after short waits — one and ten minutes by default — before it gets an interval in days.
- Buttons that show their wait:
preview()gives what each of the four answers would do, for « 10 min », « 2 days », « 8 days » on a review screen. - A queue for a session: cards in learning first, then due cards the most likely forgotten first, then new cards, each within its limit. Missed days carry no penalty and there is no streak to lose.
- Logs that replay: every review gives a log of identifiers and figures, never what the card asks. Replaying a card's logs under new weights gives the card those weights would have given.
- Stable on every server: intervals of three days or more are spread so that cards learned together do not fall due together, from a hash of the card and its review number; the same review always gives the same date, and the scheduler keeps no state, safe in a long-running worker.
- Versioned JSON: cards and logs encode to small JSON objects with their version and algorithm, and decoding checks every field, within a size limit.
Status
| Part | State |
|---|---|
| The FSRS-6 formulas, with FSRS-5 weights read | Implemented and tested |
| Learning and relearning steps, spread intervals, same-day reviews | Implemented and tested |
| Preview, probability of recall, forgetting a card | Implemented and tested |
| Replaying logs under other parameters | Implemented and tested |
| The review queue | Implemented and tested |
| The JSON codec of cards and logs | Implemented and tested, fuzzed |
Documentation
| Document | What it covers |
|---|---|
| Installation | Requirements, installing, a first review. |
| The algorithm | FSRS-6: stability, difficulty, recall, each formula and its weights. |
| Scheduling | States, steps, intervals, the spread, the preview, the queue and replays. |
| Storage | Columns for a card, the JSON codec, logs and optimised weights. |
| Extension points | The parameters, the source of the spread, what is stable. |
| Testing | The tests, the fuzz target and the benchmark. |
| Reference | Every public type, with its role. |
Quick start
Requirements
PHP 8.5 or later.
Contributing
Contributions are welcome on the PHIL monorepo: read the contribution guide and the security policy explains, never in a public issue.
License
MIT, © Philippe Gamache, doing business as Le Gnome Archiviste; a Parler Haut Interagir Librement project. See LICENSE.