keypax / glicko2
A PHP implementation of the Glicko2 rating system. Fork of zelenin/glicko2, updated and compatible with PHP 8.1+
1.1.1
2025-06-06 07:17 UTC
Requires
- php: ^8.1
Requires (Dev)
- phpunit/phpunit: ^10.0
This package is auto-updated.
Last update: 2025-06-06 07:19:18 UTC
README
A PHP implementation of Glicko2 rating system Fork of zelenin/glicko2 with PHP 8.1 support
Installation
Composer
composer require keypax/glicko2:"^1.0.0"
Usage
Create two players with current ratings:
use Zelenin\Glicko2\Glicko2; use Zelenin\Glicko2\RatingMatch; use Zelenin\Glicko2\RatingMatchCollection; use Zelenin\Glicko2\Player; $glicko = new Glicko2(); $player1 = new Player(1700, 250, 0.05); $player2 = new Player(); $ratingMatch = new RatingMatch($player1, $player2, 1, 0); $glicko->calculateRatingMatch($ratingMatch); $ratingMatch = new RatingMatch($player1, $player2, 3, 2); $glicko->calculateRatingMatch($ratingMatch); // or $ratingMatchCollection = new RatingMatchCollection(); $ratingMatchCollection->addRatingMatch(new RatingMatch($player1, $player2, 1, 0)); $ratingMatchCollection->addRatingMatch(new RatingMatch($player1, $player2, 3, 2)); $glicko->calculateRatingMatches($ratingMatchCollection); $newPlayer1R = $player1->getR(); $newPlayer2R = $player2->getR();
Author
Aleksandr Zelenin, e-mail: aleksandr@zelenin.me