1. Go to this page and download the library: Download ghorwood/phelo 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/ */
ghorwood / phelo example snippets
use ghorwood\Phelo\Phelo;
$phelo = new Phelo();
$phelo = new Phelo();
// Create player 'jasminder' with elo of 1000
$phelo->jasminder = 1000;
// You can also use variables. This is the method you should use for multi-word names.
$player1 = 'jasminder';
$phelo->$player1 = 1000;
$player2 = 'Barry Clarke';
$phelo->$player2 = 1000;
$player3 = "白百柏";
$phelo->$player3 = 1000;
$phelo = new Phelo();
$phelo->Jerry = 1000;
$phelo->Sigrid = 910;
// Calculate the percent chance of Jerry winning by passing as first argument
$chanceJerryWins = $phelo->chance("Jerry", "Sigrid");
// Repeat, but for Sigrid
$chanceSigridWins = $phelo->chance("Sigrid", "Jerry");
// Chance of winning is a percent to two decimal places.
print $chanceJerryWins; // 62.67
print $chanceSigridWins; // 37.33
// Percentage chances add up to 100.00
print $chanceSigridWins + $chanceJerryWins; // 100.00
$phelo = new \ghorwood\Phelo\Phelo();
$phelo->Tyrone = 1200;
$phelo->Katarina = 800;
// Katarina defeats Tyrone
$phelo->match('Katarina', 'Tyrone');
// Get the updated elo scores
print $phelo->Katarina; // 827
print $phelo->Tyrone; // 1173
$phelo = new \ghorwood\Phelo\Phelo();
$phelo->Tyrone = 1200;
$phelo->Katarina = 800;
// Katarina defeats Tyrone in four consecutive matches
$phelo->match("Katarina", "Tyrone")
->match("Katarina", "Tyrone")
->match("Katarina", "Tyrone")
->match("Katarina", "Tyrone");
// Get the updated elo scores
print $phelo->Katarina; // 902
print $phelo->Tyrone; // 1099
// K factor FIDE uses for players under 18.
$phelo = new \ghorwood\Phelo\Phelo(40);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.