fruitcakestudio/knvb-dataservice-api

KNVB Dataservice API


Keywords
knvb, dataservice, sportlink
License
MIT

Documentation

KNVB Dataservice API Wrapper

Use Composer to install this package ("fruitcakestudio/knvb-dataservice-api": "0.2.x@dev",) and require the autoloader.

You can use the HttpClient to make requests to the API directly or use the API object to get more abstracted results.

All objects have public properties, matching the key/value from the API directly.

See the documentation on http://api.knvbdataservice.nl/v2/

Simple example:

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();
    }
}