PHP code example of avantar / bracket-generator

1. Go to this page and download the library: Download avantar/bracket-generator 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/ */

    

avantar / bracket-generator example snippets


$generator = new \BracketGenerator\Generator();

$generator->generate(8);

[
    [
        'id' => 1,
        'round' => 1,
        'game_in_round' => 1,
        'next_game_id' => 5
    ],
    [
        'id' => 2,
        'round' => 1,
        'game_in_round' => 2,
        'next_game_id' => 5
    ],
    [
        'id' => 3,
        'round' => 1,
        'game_in_round' => 3,
        'next_game_id' => 6
    ],
    [
        'id' => 4,
        'round' => 1,
        'game_in_round' => 4,
        'next_game_id' => 6
    ],
    [
        'id' => 5,
        'round' => 2,
        'game_in_round' => 1,
        'next_game_id' => 7
    ],
    [
        'id' => 6,
        'round' => 2,
        'game_in_round' => 2,
        'next_game_id' => 7
    ],
    [
        'id' => 7,
        'round' => 3,
        'game_in_round' => 1,
        'next_game_id' => null
    ],
];