youhey / elo
A PHP implementation of Elo rating system
1.0.1
2020-03-10 10:53 UTC
Requires
- php: >=7.4.0
Requires (Dev)
- phpunit/phpunit: ^9
This package is auto-updated.
Last update: 2024-09-10 21:07:02 UTC
README
A PHP implements of Elo rating system.
Installation
Composer
The preferred way to install this extension is through Composer.
Either run
php composer.phar require youhey/elo "~1.0.0"
or add
"youhey/elo": "~1.0.0"
to the require section of your composer.json
Usage
Create two players with current ratings:
use Youhey\Elo\Elo; use Youhey\Elo\Match; use Youhey\Elo\Player; $elo = new Elo(); $player = new Player(1700.0); $opponent = new Player(1650.0); $match = new Match($player, $opponent, 1.0, 0.0); $elo->calculateMatch($match); $match = new Match($player, $opponent, 3.0, 2.0); $elo->calculateMatch($match); $newPlayerRating = $player->getRating(); $newOpponentRating = $opponent->getRating();
Author
Ikeda Youhei, e-mail: youhey.ikeda@gmail.com