chovanec/elo-rating

There is no license information available for the latest version (dev-master) of this package.

A PHP implementation of Elo rating system

dev-master 2018-09-13 00:00 UTC

This package is auto-updated.

Last update: 2024-04-16 21:17:28 UTC


README

A PHP class which implements the Elo rating system.

Install with composer

composer require chovanec/elo-rating dev-master

Link to Packagist.org: https://packagist.org/packages/chovanec/elo-rating

Usage

require 'src/Rating/Rating.php';

// player A elo = 1000
// player B elo = 2000
// player A lost
// player B win

$rating = new Rating(1000, 2000, Rating::LOST, Rating::WIN);

// player A elo = 1000
// player B elo = 2000
// player A draw
// player B draw

$rating = new Rating(1000, 2000, Rating::DRAW, Rating::DRAW);

$results = $rating->getNewRatings();

echo "New rating for player A: " . $results['a'];
echo "New rating for player B: " . $results['b'];

Credits

Creative Commons License
Elo Rating PHP by Michal Chovanec is licensed under a Creative Commons Attribution 4.0 International License.