PHP code example of dolejska-daniel / challonge-api

1. Go to this page and download the library: Download dolejska-daniel/challonge-api 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/ */

    

dolejska-daniel / challonge-api example snippets


use ChallongeAPI\ChallongeAPI;

$api = new ChallongeAPI([
	//  Your Challonge API key, you can get one at https://challonge.com/settings/developer
	ChallongeAPI::SET_API_KEY => 'YOUR_CHALLONGE_API_KEY'
]);

// Fetches all tournaments created on your account
$api->tList();

// Fetches all tournaments created by organization 'csgo' (csgo.challonge.com)
$api->tList('csgo');

// Fetches all tournaments created on your account
$list = $api->tList();

//  Outputs name of all tournaments on your account
foreach ($list->getTournaments() as $tournament)
	echo $tournament->name . "<br>";

//  Finds tournament by it's ID in the list
$tournament = $list->getTournamentById(123456789);
echo $tournament->name . "<br>";

//  Finds tournament by it's URL name in the list
$tournament = $list->getTournamentByUrl('best_tournament');
echo $tournament->name . "<br>";