PHP code example of elijahcruz / elo-rating

1. Go to this page and download the library: Download elijahcruz/elo-rating library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

elijahcruz / elo-rating example snippets


use EloRating\Player;

$player1 = new Player(1200);
$player2 = new Player(800);

use EloRating\Game;

$match = new Game($player1, $player2);

$match->setK(16);

$match->setScore(0, 1)
   ->count();

$player1 = $match->getPlayer1();
$player2 = $match->getPlayer2();

$newRating1 = $player1->getRating();
$newRating2 = $player2->getRating();