avolle/fotballdata

A package for fetching data from Norwegian Football API service Fotballdata

0.9.4 2024-02-23 20:47 UTC

This package is auto-updated.

Last update: 2024-10-23 22:18:06 UTC


README

codecov GitHub PHP Version Require

A library for fetching data from Norwegian Football API service Fotballdata.

Installation:

composer install avolle/fotballdata

Gotchas

As match is a protected control structure token for PHP from version 8.0 and up, we need to alias the Match entity. Therefore all Match results use the Game entity. Only the entity name is aliased. Requests and hasMany relationships continue to use Matches.

Usage:

Anywhere in your code:

<?php

require 'vendor/autoload.php';

use Avolle\Fotballdata\Request\MatchesRequests;

// Remember to define config keys. See Configuration below.
$config = [];

$matchesRequests = new MatchesRequests($config);
/** @var \Avolle\Fotballdata\Entity\Game $match */
$match = $matchesRequests->get(1);

Configuration

Configuration keys. Only clubId, cid and cwd are required from you. These values are given by Fotballdata.

<?php

use Avolle\Fotballdata\Request\ClubsRequests;

$config = [
    'clubId' => 69,
    'cid' => 666,
    'cwd' => 42,
];

$request = new ClubsRequests($config);

Supports the following requests:

Clubs

Districts

Matches

Seasons

Stadiums

Teams

Tournaments