PHP Classes
elePHPant
Icontem

PHP Tournament Bracket Generator: Organize the matches of teams in a tournament

Recommend this page to a friend!
  Info   View files Documentation   View files View files (73)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2019-08-31 (16 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 34 This week: 5All time: 9,648 This week: 53Up
Version License PHP version Categories
tournament-generator 0.3Custom (specified...7Games, PHP 7
Description Author

This package can be used to organize the matches of teams in a tournament.

It provides a set of classes used to create multiple kinds of tournament brackets.

The package can take parameters that list the teams that are involved in a tournament, as well rules that define how the teams progress after each match. Then it generates the schedule of the matches that will happen with the teams that were listed.

  Performance   Level  
Name: Tomáš Vojík <contact>
Classes: 1 package by
Country: Czech Republic
Age: 19
All time rank: 42962 in Czech Republic
Week rank: 68 Up1 in Czech Republic Up

Details

<h1 align="center"> <br> Tournament Generator <br> </h1>

<h4 align="center">A set of multiple classes to generate and work with all different kinds of tournament brackets or defining a custom bracket.</h4>

<p align="center"> <a href="https://packagist.org/packages/heroyt/tournament-generator"><img src="https://poser.pugx.org/heroyt/tournament-generator/v/stable" alt="Latest Stable Version"></a> <a href="https://packagist.org/packages/heroyt/tournament-generator"><img src="https://poser.pugx.org/heroyt/tournament-generator/downloads" alt="Total Downloads"></a> <a href="https://scrutinizer-ci.com/g/heroyt/tournament-generator/?branch=master"><img src="https://scrutinizer-ci.com/g/heroyt/tournament-generator/badges/quality-score.png?b=master" alt="Scrutinizer Code Quality" data-canonical-src="https://scrutinizer-ci.com/g/heroyt/tournament-generator/badges/quality-score.png?b=master" style="max-width:100%;"></a> <a href="https://scrutinizer-ci.com/g/Heroyt/tournament-generator/build-status/master"><img src="https://scrutinizer-ci.com/g/Heroyt/tournament-generator/badges/build.png?b=master" alt="Scrutinizer Build" data-canonical-src="https://scrutinizer-ci.com/g/Heroyt/tournament-generator/badges/build.png?b=master" style="max-width:100%;"></a> <a href="(https://scrutinizer-ci.com/g/Heroyt/tournament-generator/?branch=master"><img src="https://scrutinizer-ci.com/g/Heroyt/tournament-generator/badges/coverage.png?b=master" alt="Code Coverage" data-canonical-src="https://scrutinizer-ci.com/g/heroyt/tournament-generator/badges/quality-score.png?b=master" style="max-width:100%;"></a> <a href='https://tournament-generator.readthedocs.io/en/latest/?badge=latest'>

<img src='https://readthedocs.org/projects/tournament-generator/badge/?version=latest' alt='Documentation Status' />

</a>

</p>

Documentation

Features

  • Creating a custom tournament bracket with any number of categories, rounds, groups and teams
  • Defining a multiple different conditions
  • Easily generating Robin-Robin tournaments
  • Generating a tournament using a predefined preset (single elimination, double elimination, 2R2G) with any number of teams
  • Generating brackets with 2 to 4 teams in one game against each other
  • Filling your bracket with results and getting teams table with scores

Installation

composer require heroyt/tournament-generator

Basic Usage

require 'vendor/autoload.php';

// Create a tournament
$tournament = new TournamentGenerator\Tournament('Tournament name');

// Set tournament lengths - could be omitted
$tournament
	->setPlay(7) // SET GAME TIME TO 7 MINUTES
	->setGameWait(2) // SET TIME BETWEEN GAMES TO 2 MINUTES
	->setRoundWait(0); // SET TIME BETWEEN ROUNDS TO 0 MINUTES

// Create a round and a final round
$round = $tournament->round("First's round's name");
$final = $tournament->round("Final's round's name");

// Create 2 groups for the first round
$group_1 = $round->group('Round 1')
	->setInGame(2) // 2 TEAMS PLAYING AGAINST EACH OTHER
	->setType(TournamentGenerator\Constants::ROUND_ROBIN); // ROBIN-ROBIN GROUP
$group_2 = $round->group('Round 2')
	->setInGame(2) // 2 TEAMS PLAYING AGAINST EACH OTHER
	->setType(TournamentGenerator\Constants::ROUND_ROBIN); // ROBIN-ROBIN GROUP

// Create a final group
$final_group = $final->group('Finale')
	->setInGame(2) // 2 TEAMS PLAYING AGAINST EACH OTHER
	->setType(TournamentGenerator\Constants::ROUND_ROBIN); // ROBIN-ROBIN GROUP

// CREATE 6 TEAMS
for ($i=1; $i <= 6; $i++) {
	$tournament->team('Team '.$i);
}

// SET PROGRESSIONS FROM GROUP 1 AND 2 TO FINAL GROUP
$group_1->progression($final_group, 0, 2); // PROGRESS 2 BEST WINNING TEAMS
$group_2->progression($final_group, 0, 2); // PROGRESS 2 BEST WINNING TEAMS

// Generate games in the first round
$round->genGames();
// Simulate results (or you can fill it with your own real results)
$round->simulate();
// Progress best teams from first round to final round
$round->progress();
// Generate games in the final round
$final->genGames();
// Simulate results (or you can fill it with your own real results)
$final->simulate();

// GET ALL TEAMS
$teams = $tournament->getTeams(true); // TRUE to get teams ordered by their results

Creating a tournament with a template

require 'vendor/autoload.php';

// Create a tournament
$tournament = new TournamentGenerator\Preset\Tournament_SingleElimination('Tournament name');

// Set tournament lengths - could be omitted
$tournament
	->setPlay(7) // SET GAME TIME TO 7 MINUTES
	->setGameWait(2) // SET TIME BETWEEN GAMES TO 2 MINUTES
	->setRoundWait(0); // SET TIME BETWEEN ROUNDS TO 0 MINUTES

// CREATE 6 TEAMS
for ($i=1; $i <= 6; $i++) {
	$tournament->team('Team '.$i);
}

// GENERATE ALL GAMES
$tournament->generate();

// Simulate games
$tournament->genGamesSimulate(); // Simulate only games for example to only save bracket to DB
$tournament->genGamesSimulateReal(); // Simulate games with results like a real tournament

// GET ALL TEAMS
$teams = $tournament->getTeams(true); // TRUE to get teams ordered by their results
  Files folder image Files  
File Role Description
Files folder imagebuild (2 files)
Files folder imagedocs (1 file, 4 directories)
Files folder imagesrc (1 directory)
Files folder imagetests (14 files)
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file mkdocs.yml Data Auxiliary data
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file readme.md Data Read me

  Files folder image Files  /  build  
File Role Description
  Accessible without login Plain text file coverage.serialized Example Example script
  Accessible without login Plain text file coverage.xml Data Auxiliary data

  Files folder image Files  /  docs  
File Role Description
Files folder imageclasses (10 files)
Files folder imageexamples (5 files)
Files folder imageinterface (5 files)
Files folder imagetemplate (4 files)
  Accessible without login Plain text file index.md Doc. Documentation

  Files folder image Files  /  docs  /  classes  
File Role Description
  Accessible without login Plain text file blankTeam.md Doc. Documentation
  Accessible without login Plain text file category.md Doc. Documentation
  Accessible without login Plain text file constants.md Doc. Documentation
  Accessible without login Plain text file game.md Doc. Documentation
  Accessible without login Plain text file group.md Doc. Documentation
  Accessible without login Plain text file progression.md Doc. Documentation
  Accessible without login Plain text file round.md Doc. Documentation
  Accessible without login Plain text file team.md Doc. Documentation
  Accessible without login Plain text file teamFilter.md Doc. Documentation
  Accessible without login Plain text file tournament.md Doc. Documentation

  Files folder image Files  /  docs  /  examples  
File Role Description
  Accessible without login Plain text file basic.md Doc. Documentation
  Accessible without login Plain text file filters.md Doc. Documentation
  Accessible without login Plain text file preset.md Doc. Documentation
  Accessible without login Plain text file progressions.md Doc. Documentation
  Accessible without login Plain text file simulating.md Doc. Documentation

  Files folder image Files  /  docs  /  interface  
File Role Description
  Accessible without login Plain text file base.md Doc. Documentation
  Accessible without login Plain text file WithGeneratorSetters.md Doc. Documentation
  Accessible without login Plain text file WithRounds.md Doc. Documentation
  Accessible without login Plain text file WithSkipSetters.md Doc. Documentation
  Accessible without login Plain text file WithTeams.md Doc. Documentation

  Files folder image Files  /  docs  /  template  
File Role Description
  Accessible without login Plain text file 2R2G.md Doc. Documentation
  Accessible without login Plain text file doubleElim.md Doc. Documentation
  Accessible without login Plain text file list.md Doc. Documentation
  Accessible without login Plain text file singleElim.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
Files folder imageTournamentGenerator (17 files, 2 directories)

  Files folder image Files  /  src  /  TournamentGenerator  
File Role Description
Files folder imagePreset (3 files)
Files folder imageUtilis (3 files, 1 directory)
  Plain text file Base.php Class Class source
  Plain text file BlankTeam.php Class Class source
  Plain text file Category.php Class Class source
  Plain text file Constants.php Class Class source
  Plain text file Filter.php Class Class source
  Accessible without login Plain text file functions.php Aux. Auxiliary script
  Plain text file Game.php Class Class source
  Plain text file Group.php Class Class source
  Plain text file Progression.php Class Class source
  Plain text file Round.php Class Class source
  Plain text file Team.php Class Class source
  Plain text file TeamFilter.php Class Class source
  Plain text file Tournament.php Class Class source
  Plain text file WithGeneratorSetters.php Class Class source
  Plain text file WithRounds.php Class Class source
  Plain text file WithSkipSetters.php Class Class source
  Plain text file WithTeams.php Class Class source

  Files folder image Files  /  src  /  TournamentGenerator  /  Preset  
File Role Description
  Plain text file DoubleElimination.php Class Class source
  Plain text file R2G.php Class Class source
  Plain text file SingleElimination.php Class Class source

  Files folder image Files  /  src  /  TournamentGenerator  /  Utilis  
File Role Description
Files folder imageSorter (2 files)
  Plain text file FilterComparator.php Class Class source
  Plain text file Generator.php Class Class source
  Plain text file Simulator.php Class Class source

  Files folder image Files  /  src  /  TournamentGenerator  /  Utilis  /  Sorter  
File Role Description
  Plain text file Games.php Class Class source
  Plain text file Teams.php Class Class source

  Files folder image Files  /  tests  
File Role Description
  Plain text file CategoryTest.php Class Class source
  Plain text file DoubleEliminationTest.php Class Class source
  Plain text file FilterTest.php Class Class source
  Plain text file FunctionsTest.php Class Class source
  Plain text file GameTest.php Class Class source
  Plain text file GeneratorTest.php Class Class source
  Plain text file GroupTest.php Class Class source
  Plain text file ProgressionTest.php Class Class source
  Plain text file RoundTest.php Class Class source
  Plain text file SingleEliminationTest.php Class Class source
  Plain text file TeamFilterTest.php Class Class source
  Plain text file TeamTest.php Class Class source
  Plain text file TournamentTest.php Class Class source
  Plain text file TwoRoundsTest.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:34
This week:5
All time:9,648
This week:53Up