dolejska-daniel/challonge-api

PHP7的ChallongeAPI包装器

v0.3 2017-06-29 07:18 UTC

This package is auto-updated.

Last update: 2024-09-20 01:18:59 UTC


README

版本 pre-v0.4

Build Status Test Coverage GitHub release GitHub pre release Packagist Packagist

目录

  1. 简介
  2. ChallongeAPI
    1. 初始化库
    2. 使用库
    3. 利用对象

简介

这是PHP7的Challonge API包装器!

使用简单,代码清晰。

ChallongeAPI

初始化库

初始化库很简单,只需要array的设置。主要的是你的SET_API_KEY。看看这个

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'
]);

可用的库设置:

使用库

使用Challonge API从未如此简单!

// 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>";