thesportsdb-client

League extends ApiRecord
in package

Read onlyYes
FinalYes

A league or cup. Lists (`all_leagues.php`, v2 `search/league`) fill only a few fields; look it up by id for the rest.

Table of Contents

Properties

$alternateNames  : array<int, string>
$apiFootballId  : int|null
`idAPIfootball`
$apiFootballV3Id  : int|null
`idAPIfootballv3`
$badge  : string|null
`strBadge`
$banner  : string|null
`strBanner`
$country  : string|null
`strCountry`
$currentSeason  : string|null
`strCurrentSeason`, e.g. `2026-2027` or `2026`. Pass it to season endpoints.
$descriptions  : array<string, string>
$division  : int|null
`intDivision`: 1 for a top flight; cups often use 0 or 99
$eventNaming  : string|null
`strNaming`: the event-name template, e.g. `{strHomeTeam} vs {strAwayTeam}`
$fanart  : array<int, string>
$firstEventDate  : DateTimeImmutable|null
`dateFirstEvent` (a date, as midnight UTC)
$formedYear  : int|null
`intFormedYear`
$gender  : string|null
`strGender`
$id  : int|null
`idLeague`
$isComplete  : bool|null
`strComplete`: whether TheSportsDB considers its data complete
$isCup  : bool|null
`idCup`: true for a cup competition
$isLocked  : bool|null
`strLocked`
$logo  : string|null
`strLogo`
$name  : string|null
`strLeague`
$poster  : string|null
`strPoster`
$raw  : array<string|int, mixed>
$socials  : Socials
$sport  : string|null
`strSport`
$trophy  : string|null
`strTrophy`
$tvRights  : string|null
`strTvRights`: free text

Methods

__construct()  : mixed
__toString()  : string
description()  : string|null
The English description.
equals()  : bool
True when $other is the same kind of record, built from the same API fields.
fmt()  : string

Properties

$alternateNames

public array<int, string> $alternateNames

strLeagueAlternate, split on commas

$apiFootballId

`idAPIfootball`

public int|null $apiFootballId

$apiFootballV3Id

`idAPIfootballv3`

public int|null $apiFootballV3Id

$badge

`strBadge`

public string|null $badge

$banner

`strBanner`

public string|null $banner

$country

`strCountry`

public string|null $country

$currentSeason

`strCurrentSeason`, e.g. `2026-2027` or `2026`. Pass it to season endpoints.

public string|null $currentSeason

$descriptions

public array<string, string> $descriptions

strDescriptionEN, strDescriptionDE, ... keyed by language code (EN, DE)

$division

`intDivision`: 1 for a top flight; cups often use 0 or 99

public int|null $division

$eventNaming

`strNaming`: the event-name template, e.g. `{strHomeTeam} vs {strAwayTeam}`

public string|null $eventNaming

$fanart

public array<int, string> $fanart

strFanart1..strFanart4

$firstEventDate

`dateFirstEvent` (a date, as midnight UTC)

public DateTimeImmutable|null $firstEventDate

$formedYear

`intFormedYear`

public int|null $formedYear

$gender

`strGender`

public string|null $gender

$id

`idLeague`

public int|null $id

$isComplete

`strComplete`: whether TheSportsDB considers its data complete

public bool|null $isComplete

$isCup

`idCup`: true for a cup competition

public bool|null $isCup

$isLocked

`strLocked`

public bool|null $isLocked

`strLogo`

public string|null $logo

$name

`strLeague`

public string|null $name

$poster

`strPoster`

public string|null $poster

$sport

`strSport`

public string|null $sport

$trophy

`strTrophy`

public string|null $trophy

$tvRights

`strTvRights`: free text

public string|null $tvRights

Methods

__construct()

public __construct(array<string, string|null> $raw) : mixed
Parameters
$raw : array<string, string|null>

every field as the API sent it (blank strings as null); use it for fields not modelled yet: $team->raw['strKeywords']

__toString()

public __toString() : string
Return values
string

description()

The English description.

public description() : string|null
Return values
string|null

equals()

True when $other is the same kind of record, built from the same API fields.

public equals(self|null $other) : bool
Parameters
$other : self|null
Return values
bool

fmt()

protected fmt(mixed $value) : string
Parameters
$value : mixed
Return values
string
On this page

Search results