PHP Classes

File: wiki/examples/

Recommend this page to a friend!
  Classes of Tomáš Vojík   PHP Tournament Bracket Generator   wiki/examples/   Download  
File: wiki/examples/
Role: Auxiliary data
Content type: text/markdown
Description: Auxiliary data
Class: PHP Tournament Bracket Generator
Organize the matches of teams in a tournament
Author: By
Last change:
Date: 3 years ago
Size: 2,286 bytes


Class file image Download


Simulating a tournament|category|round|group can help you to generate in advance, or just to test your bracket.

There are two types of simulating a tournament

  1. Simulating without results - This is used only to generate brackets for example to save them for later - It simulates each group being played, progresses blank teams and then resets the results
  2. Simulating with results = real - This is used to test out your bracket and scoring - It generates random results for each game, progressing groups with normal teams and finishing the whole tournament like it was played for real

Simulating round or group

Round and Group has a simulate() method which by default simulates its games with results. The simulate() method will however not generate any games, it will only generate random results for all the games. You have to generate the games beforehand.


And if you want to progress them and then reset the results, you can do this with a progress() and resetGames() methods.

Please note that if you want to progress blank teams, you have to give progressed() an argument of true;


This will progress blank teams and reset all the results.

Simulating the whole tournament or category

Tournament and Category has a build in methods to simulate itself with or without results. These methods will also generate all necessary games.

$games = $tournament->genGamesSimulate();
$games = $category->genGamesSimulate();

This will generate all the results, games, progress blank teams and then reset all results.

$games = $tournament->genGamesSimulateReal();
$games = $category->genGamesSimulateReal();

This will generate all the results, games, progress normal teams and keep the results.