dolejska-daniel/bracket-generator

v0.2 2018-01-29 18:32 UTC

This package is auto-updated.

Last update: 2024-10-29 04:59:24 UTC


README

Version v0.2

Table of Contents

  1. Introduction
  2. Downloading
  3. Usage example

Introduction

Welcome to bracket generator for PHP7 repo. This library uses HTML tables to render nice and clean game brackets. You can create brackets based on participant count, match list or even custom tree. Bracket visuals are also completly customizable.

Please, refer mainly to the wiki pages.

Downloading

The easiest way to get this library is to use Composer. While having Composer installed it takes only composer require dolejska-daniel/bracket-generator and composer update to get the library up and ready!

If you are not fan of Composer, you can download whole repository in .zip archive or clone the repository using Git - git clone https://github.com/dolejska-daniel/bracket-generator. But in this case, you will have to create your own autoload function.

Usage example

All it takes to create a bracket is this:

use BracketGenerator\Bracket;
echo Bracket::create(8);

And what will you end up with after this? Take a look:

Empty bracket for 8 participants

It looks a bit empty so you can fill it up very easily - let's start from the beginning:

use BracketGenerator\Bracket;

$bracket = Bracket::create(8);
$bracket->fillByParticipantList([
	[ 'Participant 1', 0 ],
	[ 'Participant 2', 0 ],
	[ 'Participant 3', 0 ],
	[ 'Participant 4', 0 ],
	[ 'Participant 5', 0 ],
	[ 'Participant 6', 0 ],
	[ 'Participant 7', 0 ],
	[ 'Participant 8', 0 ],
]);

echo $bracket;

And that gives us:

Filled bracket for 8 participants

Please remember that the bracket visuals are completly customizable. This is just an example.

For more, please see the wiki pages.