devdch / fsrs
Free Spaced Repetition Scheduler (FSRS) algorithm implementation in PHP.
dev-main
2025-01-13 18:59 UTC
Requires
- php: ^8.3
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^11.5
This package is auto-updated.
Last update: 2025-08-13 20:22:55 UTC
README
Free Spaced Repetition Scheduler (FSRS) algorithm implementation in PHP
More info about FSRS here: https://github.com/open-spaced-repetition/awesome-fsrs
Example:
use Fsrs\Config\Config; use Fsrs\DTO\Card; use Fsrs\Enum\RatingEnum; use Fsrs\Enum\StateEnum; use Fsrs\Scheduler; // All params are optional (default config will be used). $scheduler = new Scheduler(config: new Config( weights: [ 0.40255, 1.18385, 3.173, 15.69105, 7.1949, 0.5345, 1.4604, 0.0046, 1.54575, 0.1192, 1.01925, 1.9395, 0.11, 0.29605, 2.2698, 0.2315, 2.9898, 0.51655, 0.6621, ], desiredRetention: 0.9, learningSteps: [60, 600,], relearningSteps: [600,], maximumInterval: 36500, enableFuzzing: true, )); $card = new Card(); $card = $scheduler->reviewCard( card: $card, rating: RatingEnum::Good, reviewDatetime: new DateTimeImmutable('now', Config::getTimezone()) )->card;