abijahkaj / memorize
A PHP implementation of the SM-2 algorithm
Installs: 16
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 8
pkg:composer/abijahkaj/memorize
Requires
- php: >=7.3
- ext-json: *
Requires (Dev)
- phpunit/phpunit: 3.7.*
This package is auto-updated.
Last update: 2026-01-07 19:23:33 UTC
README
A PHP implementation of the SM-2 algorithm.
About
This is a library created by me to try out popular tools such as Travis, Packagist and Composer, as well as setting up a library structure and enhancing my understanding of test driven development. While being a test project for me, the library is still completely usable and could be used by any database of questions and answers to implement spaced repetition in an application.
Features
- Calculate the interval in which to repeat an item after the n:th repetition based on an E-factor.
- Calculate an E-factor for an item based on the old factor (or no factor) and a response quality.
Installation
Memorize is installed through Composer. Run this command
composer require abijahkaj/memorize
Or add the following to your composer.json file.
{ "require": { "abijahkaj/memorize": "1.*" } }
The algorithm
SM is a family of algorithms made popular by the SuperMemo software package. The Memorize library implements the complete SM-2 algorithm in PHP. The SM2 class handles calculating repetition intervals and E-factors. The Card class handles flash cards and how many times they have been virtually repeated. Finally, the Repeater class handles actual repetition of a CardQueue, deciding which cards to repeat first and if they have been repeated successfully or not.
Testing
Run PHPUnit with $ phpunit in the root directory.
Author
- Shahin Zarrabi - shahin@wiwo.se - @wiwofone - http://www.wiwo.se
- Abijah Kajabika - me@realabijah.com - @abijahkaj - https://realabijah.com