fruitcakestudio/

knvb-dataservice-api

KNVB Dataservice API

v0.2.2 2016-08-30 12:01 UTC

This package is auto-updated.

Last update: 2024-09-11 09:23:59 UTC


README

使用Composer安装此包("fruitcakestudio/knvb-dataservice-api": "0.2.x@dev",)并要求自动加载。

您可以使用HttpClient直接对API进行请求,或使用API对象获取更抽象的结果。

所有对象都有公共属性,直接匹配API中的键/值。

请参阅http://api.knvbdataservice.nl/v2/上的文档。

简单示例

require_once __DIR__ .'/../vendor/autoload.php';

use KNVB\Dataservice\Api;

// Create a new API instance
$api = new Api($pathname, $key);

// Initialize the club
$club = $api->getClub();

echo $club->getName();
echo $club->getBanner()->getOutput('leaderboard');

$matches = $club->getMatches();
$competitions = $club->getCompetitions();

foreach($club->getTeams() as $team){
    echo $team->getName();
    $results = $team->getResults();
    $schedule = $team->getSchedule();
    
    foreach($team->getCompetitions() as $competition){
        echo $competition->getName();
        $results = $competition->getResults();
        $schedule = $competition->getSchedule();
        $ranking = $competition->getRanking();
    }
}