ilmala/tourney

A simple random tournament generator

0.1.1 2022-10-28 08:48 UTC

This package is auto-updated.

Last update: 2024-04-28 12:53:07 UTC


README

A simple random tournament generator

Features:

  • From 3 to 30 teams tournament
  • Even and Odd team number with rest turn

How to use:

use Tourney\Tourney;

$teamNames = [
    'Bayern Monaco',
    'Olimpia Milano',
    'Partizan',
    'Virtus Bologna'
];

$tournament = (new Tourney())->generate(
    participants: $teams,
);

Print out results:

// Basic Loop 
foreach ($tournament->turns() as $turn) {
    echo "Turn {$turn->number()}<br>";
    foreach ($turn->games() as $game) {
        echo "{$game->description()}<br>";
    }
    echo "<br>";
}

Team can be an instance of Tourney\Models\Team class:

$team = new \Tourney\Models\Team(
    name: 'Olimpia Milano',
    key: 'OM-01',
);

$team->name(); // The name of the Team
$team->key(); // Maybe a reference key of your application team model