- Responses
- Football Endpoints
- Odds Endpoints
- Core Endpoints
- Pagination
- Select, Include and Filters
- Timezone, Language and Cache TTL
All successful responses will return an <Entity>Item
or an <Entity>Collection
.
One of the differences between an <Entity>Item
and an <Entity>Collection
is that the <Entity>Item
getData()
method will return a single Entity object,
while the <Entity>Collection
getData()
method will return an array of Entity objects.
For example, when requesting a fixture by id, the response will be a FixtureItem
object and the getData()
method will return a Fixture
object.
The same way that when requesting all fixtures, the response will be a FixtureCollection
object and the getData()
method will return an array of Fixture
objects.
Check the responses entities for more information.
// returns a FixtureItem object
$response = $api->fixtures()->getById(1);
// returns a Fixture object
$fixture = $response->getData();
echo $fixture->getName();
// returns a FixtureCollection object
$response = $api->fixtures()->getAll();
// returns an array of Fixture objects
$fixtures = $response->getData();
foreach ($fixtures as $fixture) {
echo $fixture->getName();
}
<Entity>Collection
responses that contain pagination data (not all of them have)
will be accessible through the getPagination()
method:
$response = $api->fixtures()->getAll();
echo $response->getPagination()->getCount();
echo $response->getPagination()->getPerPage();
echo $response->getPagination()->getCurrentPage();
echo $response->getPagination()->getNextPage();
echo $response->getPagination()->hasMore();
All responses include the getRateLimit()
method with the current quota usage.
Check the official documentation for more information.
$response = $api->fixtures()->getById(1);
echo $response->getRateLimit()->getRemainingNumRequests();
echo $response->getRateLimit()->getSecondsToReset();
echo $response->getRateLimit()->getRequestedEntity();
All responses include the getTimezone()
method with the timezone of the given data.
By default, all responses will be in the UTC
timezone.
To request data in a different timezone for all requests, check the configuration section.
For a single endpoint, check the withTimezone
section.
$response = $api->fixtures()->getById(1);
echo $response->getTimezone(); // UTC
getAll(): CoachCollection
Get all coaches:
$response = $api->coaches()->getAll();
getById(int $id): CoachItem
Get coach by id:
$response = $api->coaches()->getById(1);
getAllByCountryId(int $countryId): CoachCollection
Get all coaches by country id:
$response = $api->coaches()->getAllByCountryId(1);
getAllBySearchQuery(string $query): CoachCollection
Get all coaches by search query:
$response = $api->coaches()->getAllBySearchQuery('coach');
getAllLastUpdated(): CoachCollection
Get all coaches that received updates in the last couple of hours:
$response = $api->coaches()->getAllLastUpdated();
getAll(): CommentaryCollection
Get all commentaries:
$response = $api->commentaries()->getAll();
getAllByFixtureId(int $fixtureId): CommentaryCollection
Get all commentaries by fixture id:
$response = $api->commentaries()->getAllByFixtureId(1);
getAll(): FixtureCollection
Get all fixtures:
$response = $api->fixtures()->getAll();
getById(int $id): FixtureItem
Get fixture by id:
$response = $api->fixtures()->getById(1);
getAllByMultipleIds(array $ids): FixtureCollection
Get all fixtures by multiple ids:
$response = $api->fixtures()->getAllByMultipleIds([1, 2, 3]);
getAllByDate(\DateTimeInterface $date): FixtureCollection
Get all fixtures by date:
$response = $api->fixtures()->getAllByDate(new DateTime('today'));
getAllByDateRange(\DateTimeInterface $startDate, \DateTimeInterface $endDate): FixtureCollection
Get all fixtures by date range:
$response = $api->fixtures()->getAllByDateRange(new DateTime('today'), new DateTime('+7 days'));
getAllByTeamIdAndDateRange(int $teamId, \DateTimeInterface $startDate, \DateTimeInterface $endDate): FixtureCollection
Get all fixtures by team id and date range:
$response = $api->fixtures()->getAllByTeamIdAndDateRange(1, new DateTime('today'), new DateTime('+7 days'));
getAllByHeadToHead(int $teamId1, int $teamId2): FixtureCollection
Get all fixtures between two teams:
$response = $api->fixtures()->getAllByHeadToHead(1, 2);
getAllBySearchQuery(string $query): FixtureCollection
Get all fixtures by search query:
$response = $api->fixtures()->getAllBySearchQuery('team');
getAllUpcomingByMarketId(int $marketId): FixtureCollection
Get all upcoming fixtures by market id:
$response = $api->fixtures()->getAllUpcomingByMarketId(1);
getAllUpcomingByTvStationId(int $tvStationId): FixtureCollection
Get all upcoming fixtures by tv station id:
$response = $api->fixtures()->getAllUpcomingByTvStationId(1);
getAllPastByTvStationId(int $tvStationId): FixtureCollection
Get all past fixtures by tv station id:
$response = $api->fixtures()->getAllPastByTvStationId(1);
getAllLastUpdated(): FixtureCollection
Get all last updated fixtures:
$response = $api->fixtures()->getAllLastUpdated();
getAll(): LeagueCollection
Get all leagues:
$response = $api->leagues()->getAll();
getById(int $id): LeagueItem
Get league by id:
$response = $api->leagues()->getById(1);
getAllLive(): LeagueCollection
Get all leagues currently live:
$response = $api->leagues()->getAllLive();
getAllByFixtureDate(\DateTimeInterface $date): LeagueCollection
Get all leagues with fixtures by date:
$response = $api->leagues()->getAllByFixtureDate(new DateTime('today'));
getAllByCountryId(int $countryId): LeagueCollection
Get all leagues by country id:
$response = $api->leagues()->getAllByCountryId(1);
getAllBySearchQuery(string $query): LeagueCollection
Get all leagues by search query:
$response = $api->leagues()->getAllBySearchQuery('premiership');
getAllByTeamId(int $teamId): LeagueCollection
Get all current and historical leagues by team id:
$response = $api->leagues()->getAllByTeamId(1);
getAllCurrentByTeamId(int $teamId): LeagueCollection
Get all current leagues by team id:
$response = $api->leagues()->getAllCurrentByTeamId(1);
getAll(): FixtureCollection
Get all fixtures of the current day:
$response = $api->livescores()->getAll();
getAllInplay(): FixtureCollection
Get all fixtures that are already live, that will start within 15 minutes or that have finished in the past 15 minutes:
$response = $api->livescores()->getAllInplay();
getAllLastUpdated(): FixtureCollection
Get all fixtures that received updates in the last 10 seconds:
$response = $api->livescores()->getAllLastUpdated();
getAll(): PlayerCollection
Get all players:
$response = $api->players()->getAll();
getById(int $id): PlayerItem
Get player by id:
$response = $api->players()->getById(1);
getAllByCountryId(int $countryId): PlayerCollection
Get all players by country id:
$response = $api->players()->getAllByCountryId(1);
getAllBySearchQuery(string $query): PlayerCollection
Get all players by search query:
$response = $api->players()->getAllBySearchQuery('esgaio');
getAllLastUpdated(): PlayerCollection
Get all players that received updates in the last couple of hours:
$response = $api->players()->getAllLastUpdated();
getAll(): RefereeCollection
Get all referees:
$response = $api->referees()->getAll();
getById(int $id): RefereeItem
Get referee by id:
$response = $api->referees()->getById(1);
getAllByCountryId(int $countryId): RefereeCollection
Get all referees by country id:
$response = $api->referees()->getAllByCountryId(1);
getAllBySeasonId(int $seasonId): RefereeCollection
Get all referees by season id:
$response = $api->referees()->getAllBySeasonId(1);
getAllBySearchQuery(string $query): RefereeCollection
Get all referees by search query:
$response = $api->referees()->getAllBySearchQuery('name');
getAll(): RivalCollection
Get all rivals:
$response = $api->rivals()->getAll();
getAllByTeamId(int $teamId): RivalCollection
Get all rivals by team id:
$response = $api->rivals()->getAllByTeamId(1);
getAll(): RoundCollection
Get all rounds:
$response = $api->rounds()->getAll();
getById(int $id): RoundItem
Get round by id:
$response = $api->rounds()->getById(1);
getAllBySeasonId(int $seasonId): RoundCollection
Get all rounds by season id:
$response = $api->rounds()->getAllBySeasonId(1);
getAllBySearchQuery(string $query): RoundCollection
Get all rounds by search query:
$response = $api->rounds()->getAllBySearchQuery('30');
getAllBySeasonId(int $seasonId): StageCollection
Get complete season schedule by season id:
$response = $api->schedules()->getAllBySeasonId(1);
getAllByTeamId(int $teamId): StageCollection
Get complete schedule for all active seasons by team id:
$response = $api->schedules()->getAllByTeamId(1);
getAllBySeasonIdAndTeamId(int $seasonId, int $teamId): StageCollection
Get complete season schedule for one team by season id and team id:
$response = $api->schedules()->getAllBySeasonIdAndTeamId(1, 1);
getAll(): SeasonCollection
Get all seasons:
$response = $api->seasons()->getAll();
getById(int $id): SeasonItem
Get season by id:
$response = $api->seasons()->getById(1);
getAllByTeamId(int $teamId): SeasonCollection
Get all seasons by team id:
$response = $api->seasons()->getAllByTeamId(1);
getAllBySearchQuery(string $query): SeasonCollection
Get all seasons by search query:
$response = $api->seasons()->getAllBySearchQuery('2024');
getAll(): StageCollection
Get all stages:
$response = $api->stages()->getAll();
getById(int $id): StageItem
Get stage by id:
$response = $api->stages()->getById(1);
getAllBySeasonId(int $seasonId): StageCollection
Get all stages by season id:
$response = $api->stages()->getAllBySeasonId(1);
getAllBySearchQuery(string $query): StageCollection
Get all stages by search query:
$response = $api->stages()->getAllBySearchQuery('champions');
getAll(): StandingCollection
Get all standings:
$response = $api->standings()->getAll();
getAllBySeasonId(int $seasonId): StandingCollection
Get all standings by season id:
$response = $api->standings()->getAllBySeasonId(1);
getAllCorrectionsBySeasonId(int $seasonId): StandingCorrectionCollection
Get all standing corrections by season id:
$response = $api->standings()->getAllCorrectionsBySeasonId(1);
getAllByRoundId(int $roundId): StandingCollection
Get all standings by round id:
$response = $api->standings()->getAllByRoundId(1);
getAllLiveByLeagueId(int $leagueId): StandingCollection
Get all live standings by league id:
$response = $api->standings()->getAllLiveByLeagueId(1);
getAll(): StateCollection
Get all states:
$response = $api->states()->getAll();
getById(int $id): StateItem
Get state by id:
$response = $api->states()->getById(1);
getAllByPlayerId(int $playerId): PlayerStatisticCollection
Get all statistics by player id per season:
$response = $api->statistics()->getAllByPlayerId(1);
getAllByTeamId(int $teamId): TeamStatisticCollection
Get all statistics by team id per season:
$response = $api->statistics()->getAllByTeamId(1);
getAllByCoachId(int $coachId): CoachStatisticCollection
Get all statistics by coach id per season:
$response = $api->statistics()->getAllByCoachId(1);
getAllByRefereeId(int $refereeId): RefereeStatisticCollection
Get all statistics by referee id per season:
$response = $api->statistics()->getAllByRefereeId(1);
getAllByStageId(int $stageId): StatisticCollection
Get all statistics by stage id:
$response = $api->statistics()->getAllByStageId(1);
getAllByRoundId(int $roundId): StatisticCollection
Get all statistics by round id:
$response = $api->statistics()->getAllByRoundId(1);
getAll(): TeamCollection
Get all teams:
$response = $api->teams()->getAll();
getById(int $id): TeamItem
Get team by id:
$response = $api->teams()->getById(1);
getAllByCountryId(int $countryId): TeamCollection
Get all teams by country id:
$response = $api->teams()->getAllByCountryId(1);
getAllBySeasonId(int $seasonId): TeamCollection
Get all teams by season id:
$response = $api->teams()->getAllBySeasonId(1);
getAllBySearchQuery(string $query): TeamCollection
Get all teams by search query:
$response = $api->teams()->getAllBySearchQuery('sporting');
getAllByTeamId(int $teamId): TeamSquadCollection
Get complete team squad by team id:
$response = $api->teamSquads()->getAllByTeamId(1);
getAllExtendedByTeamId(int $teamId): PlayerCollection
Get complete team squad entries based on the current season by team id:
$response = $api->teamSquads()->getAllExtendedByTeamId(1);
getAllBySeasonIdAndTeamId(int $seasonId, int $teamId): TeamSquadCollection
Get complete team squad of one team by season id and team id:
$response = $api->teamSquads()->getAllBySeasonIdAndTeamId(1, 1);
getAllBySeasonId(int $seasonId): SeasonCollection
Get all topscorers by season id:
$response = $api->topscorers()->getAllBySeasonId(1);
getAllByStageId(int $stageId): SeasonCollection
Get all topscorers by stage id:
$response = $api->topscorers()->getAllByStageId(1);
getAll(): TransferCollection
Get all transfers:
$response = $api->transfers()->getAll();
getById(int $id): TransferItem
Get transfer by id:
$response = $api->transfers()->getById(1);
getAllLatest(): TransferCollection
Get the latest transfers:
$response = $api->transfers()->getAllLatest();
getAllByDateRange(\DateTimeInterface $startDate, \DateTimeInterface $endDate): TransferCollection
Get all transfers by date range:
$response = $api->transfers()->getAllByDateRange(new DateTime('-7 days'), new DateTime('today'));
getAllByTeamId(int $teamId): TransferCollection
Get all transfers by team id:
$response = $api->transfers()->getAllByTeamId(1);
getAllByPlayerId(int $playerId): TransferCollection
Get all transfers by player id:
$response = $api->transfers()->getAllByPlayerId(1);
getAll(): TvStationCollection
Get all tv stations:
$response = $api->tvStations()->getAll();
getById(int $id): TvStationItem
Get tv station by id:
$response = $api->tvStations()->getById(1);
getAllByFixtureId(int $fixtureId): TvStationCollection
Get all tv stations by fixture id:
$response = $api->tvStations()->getAllByFixtureId(1);
getAll(): VenueCollection
Get all venues:
$response = $api->venues()->getAll();
getById(int $id): VenueItem
Get venue by id:
$response = $api->venues()->getById(1);
getAllBySeasonId(int $seasonId): VenueCollection
Get all venues by season id:
$response = $api->venues()->getAllBySeasonId(1);
getAllBySearchQuery(string $query): VenueCollection
Get all venues by search query:
$response = $api->venues()->getAllBySearchQuery('alvalade');
getAll(): BookmakerCollection
Get all bookmakers:
$response = $api->bookmakers()->getAll();
getById(int $id): BookmakerItem
Get bookmaker by id:
$response = $api->bookmakers()->getById(1);
getAllByFixtureId(int $fixtureId): BookmakerCollection
Get all bookmakers by fixture id:
$response = $api->bookmakers()->getAllByFixtureId(1);
getAllBySearchQuery(string $query): BookmakerCollection
Get all bookmakers by search query:
$response = $api->bookmakers()->getAllBySearchQuery('bet');
getAll(): MarketCollection
Get all markets:
$response = $api->markets()->getAll();
getById(int $id): MarketItem
Get market by id:
$response = $api->markets()->getById(1);
getAllBySearchQuery(string $query): MarketCollection
Get all markets by search query:
$response = $api->markets()->getAllBySearchQuery('goal');
getAll(): OddCollection
Get all pre-match odds:
$response = $api->preMatchOdds()->getAll();
getAllByFixtureId(int $fixtureId): OddCollection
Get all pre-match odds by fixture id:
$response = $api->preMatchOdds()->getAllByFixtureId(1);
getAllByFixtureIdAndBookmakerId(int $fixtureId, int bookmakerId): OddCollection
Get all pre-match odds by fixture id and bookmaker id:
$response = $api->preMatchOdds()->getAllByFixtureIdAndBookmakerId(1, 1);
getAllByFixtureIdAndMarketId(int $fixtureId, int marketId): OddCollection
Get all pre-match odds by fixture id and market id:
$response = $api->preMatchOdds()->getAllByFixtureIdAndMarketId(1, 1);
getAllLastUpdated(): OddCollection
Get all last updated pre-match odds:
$response = $api->preMatchOdds()->getAllLastUpdated();
getAll(): CityCollection
Get all cities:
$response = $api->cities()->getAll();
getById(int $id): CityItem
Get city by id:
$response = $api->cities()->getById(1);
getAllBySearchQuery(string $query): CityCollection
Get all cities by search query:
$response = $api->cities()->getAllBySearchQuery('lisbon');
getAll(): ContinentCollection
Get all continents:
$response = $api->continents()->getAll();
getById(int $id): ContinentItem
Get continent by id:
$response = $api->continents()->getById(1);
getAll(): CountryCollection
Get all countries:
$response = $api->countries()->getAll();
getById(int $id): CountryItem
Get country by id:
$response = $api->countries()->getById(1);
getAllBySearchQuery(string $query): CountryCollection
Get all countries by search query:
$response = $api->countries()->getAllBySearchQuery('country');
getAllByEntity(): FilterEntityCollection
Get all filters grouped by entity:
$response = $api->filters()->getAllByEntity();
getAll(): RegionCollection
Get all regions:
$response = $api->regions()->getAll();
getById(int $id): RegionItem
Get region by id:
$response = $api->regions()->getById(1);
getAllBySearchQuery(string $query): RegionCollection
Get all regions by search query:
$response = $api->regions()->getAllBySearchQuery('lisboa');
getAll(): TimezoneCollection
Get all timezones:
$response = $api->timezones()->getAll();
getAll(): TypeCollection
Get all types:
$response = $api->types()->getAll();
getById(int $id): TypeItem
Get type by id:
$response = $api->types()->getById(1);
getAllByEntity(): TypeEntityCollection
Get all types grouped by entity:
$response = $api->types()->getAllByEntity();
withPage(int $page): self
Determine the results page number.
// show page 2 of the results
$api->fixtures()
->withPage(2)
->getAll();
withPerPage(int $perPage): self
Determine the number of results per page. Please note that it only affects the results of the base entity, so includes are not paginated.
// show 50 entries per page
$api->fixtures()
->withPerPage(50)
->getAll();
withSortBy(string $sortBy): self
Specifies the field by which the data will be sorted.
// results sorted by the "starting_at" field
$api->fixtures()
->withSortBy('starting_at')
->getAll();
For all available sorting options, check the official documentation.
withOrder(string $order): self
Determines the order in which the data will be sorted.
// results in descending order
$api->fixtures()
->withOrder('desc')
->getAll();
For all available order options, check the official documentation.
withPagination(int $page, int $perPage = 25, ?string $sortBy = null, string $order = 'asc'): self
Shorthand version of the combined withPage
, withPerPage
, withSortBy
and withOrder
methods.
// returns page 5 with 50 fixtures per page sorted by "starting_at" in descending order
$api->fixtures()
->withPagination(5, 50, 'starting_at', 'desc')
->getAll();
// equivalent to
$api->fixtures()
->withPage(5)
->withPerPage(50)
->withSortBy('starting_at')
->withOrder('desc')
->getAll();
withSelect(string $select): self
It is possible to request only specific fields on entities and on includes. The advantage of selecting specific fields is that it reduces the response speed in mainly large responses. In addition to reducing response time, the response size is also reduced.
For selecting fields on includes, check the withInclude
section.
// get fixture with fields "name" and "starting_at" only
$api->fixtures()
->withSelect('name,starting_at')
->getById(1);
To better understand how it works, check the official documentation.
withInclude(string $include): self
Includes allow to enrich the response with relational data. This means that it is possible to request a fixture and have the venue data in the same response without any additional requests. To check what includes ara available per endpoint, check the following documentation.
// get fixture with "venue" and "participants" (teams) data
$api->fixtures()
->withInclude('venue,participants')
->getById(1);
// it is also possible to get nested includes
// this will return venue data and country data inside the venue
$api->fixtures()
->withInclude('venue.country')
->getById(1);
To better understand how it works, check the official documentation.
To select fields in includes (similar to the withSelect
), you can do the following:
// get fixture with "venue" data with fields "name" and "city_name" only
$api->fixtures()
->withInclude('venue:name,city_name')
->getById(1);
withFilter(string $filter): self
Filters are useful to make conditional requests. For example, get fixture events that are only goals:
// get fixture with "events" that are only goals, own goals or penalties.
$api->fixtures()
->withInclude('events')
->withFilter('eventTypes:14,15,16'])
->getById(1);
To better understand how it works, check the official documentation.
withTimezone(string $timezone): self
Makes a request with a different timezone from the one globally defined in the configuration.
Check the official documentation for more information.
// get all fixtures in the Europe/Lisbon timezone
$api->fixtures()
->withTimezone('Europe/Lisbon')
->getAll();
withLanguage(string $language): self
Makes a request with a different language from the one globally defined in the configuration.
Check the official documentation for more information.
Note
This is feature is still in beta and may change in the future.
// get all fixtures in Japanese
$api->fixtures()
->withLanguage(Language::JAPANESE)
->getAll();
withCacheTtl(?int $ttl): self
Makes a request and saves into cache for the provided duration in seconds.
Semantics of values:
0
, the response will not be cached (if the servers specifies nomax-age
).null
, the response will be cached for as long as it can (forever).
Note
Setting cache to null
or 0
seconds will not invalidate any existing cache.
Available for all APIs if a cache adapter is set. Check the following documentation for more information.
// Get all fixtures and cache for 1 day
$api->fixtures()
->withCacheTtl(3600 * 24)
->getAll();