Skip to content

4. Tournaments

Kyle edited this page Aug 4, 2022 · 3 revisions

Get Tournament

$tournament = $challonge->getTournament('teamreflex-bracket1');

Returns Reflex\Challonge\DTO\Tournament for the given bracket.

The bracket name syntax is: subdomain-bracketId. If you aren't using a subdomain, then you would just use bracketId.

Get Tournaments

$challonge->getTournaments();

As basic as it gets. Returns Reflex\Challonge\DTO\Tournament for each bracket generated with the account attached to the current API key.

Create Tournament

$params = [
  'name' => "My First Bracket",
  'tournament_type' => 'single elimination',
  'subdomain' => "teamreflex",
  'url' => str_random(16),
  'hold_third_place_match' => true,
  'show_rounds' => true,
];
$tournament = $challonge->createTournament($params);

You can see all available params here: http://api.challonge.com/v1/documents/tournaments/create

Will return a Reflex\Challonge\DTO\Tournament instance for the given bracket.

Start Tournament

$tournament->start();

Closes registration and begins the tournament. Will throw Reflex\Challonge\Exceptions\AlreadyStartedException if the bracket has already been started.

End Tournament

$tournament->finalize();

Closes the tournament. Will throw Reflex\Challonge\Exceptions\StillRunningException if the bracket has already been started.

Reset Tournament

$tournament->reset();

Resets the tournament, clearing all scores and attachments.

Update Tournament

$params = [
  'name' => "My First Updated Bracket",
];
$tournament->update($params);

Updates the tournament attributes.

Delete Tournament

$tournament->delete();

Deletes the tournament.

Add Participant

$params = [
  'name' => "Player 1",
];
$tournament->addParticipant($params);

You can see all available params here: http://api.challonge.com/v1/documents/participants/create

Will return a Reflex\Challonge\DTO\Participant instance.

Bulk Add Participant

$params = [
  [
    'name' => "Player 2",
  ],
  [
    'name' => "Player 3",
  ],
];
$tournament->bulkAddParticipant($params);

You can see all available params here: http://api.challonge.com/v1/documents/participants/create

Will return an array of Reflex\Challonge\DTO\Participant instances.