avolle / fotballdata
A package for fetching data from Norwegian Football API service Fotballdata
0.9.4
2024-02-23 20:47 UTC
Requires
- php: ^7.4|^8.0
- ext-json: *
- cakephp/http: ^4.4
Requires (Dev)
- phpstan/phpstan: ^1.7
- phpunit/phpunit: ^9.5
- slevomat/coding-standard: ^8.1
- squizlabs/php_codesniffer: ^3.7
- symfony/var-dumper: ^5.4
README
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);