PHP code example of youhey / elo

1. Go to this page and download the library: Download youhey/elo 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/ */

    

youhey / elo example snippets


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();

php composer.phar