1. Go to this page and download the library: Download mrnamra/bracket-manager 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/ */
mrnamra / bracket-manager example snippets
use MrNamra\BracketManager\BracketManager;
// Boot the manager with its default repositories
$manager = BracketManager::boot();
$stage['type'] = 'double_elimination';
$stage['settings']['size'] = 8;
$stage['settings']['grandFinal'] = 'double'; // Allows for a Grand Final Reset
$result = $manager->create($stage);
// Existing tournament data (as array)
$currentData = $result->toArray();
// Update Match ID 0 with scores
$scoreUpdate = [
'id' => 0,
'opponent1' => ['score' => 2],
'opponent2' => ['score' => 1]
];
// Result will automatically advance the winner
$updatedResult = $manager->update($currentData, $scoreUpdate);
// Get fresh JSON for the frontend
$json = $updatedResult->getJson();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.