Skip to content

konradbaron/php-sportradar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP-Sportradar

PHP-Sportradar is designed to be an easy-to-use wrapper around the The Sportradar API. You must first register an account to receive an API key.

PHP-Sportradar is meant to become a full list of the Sportradar API calls available. Currently, I have only focused on the API calls for the NFL and MMA, but my roadmap for this project includes all of the other sports they offer.

##Example Usage

// Instantiate
    $nflData = new SportsDataNfl(YOUR_API_KEY,NFL_SEASON,YEAR,WEEK,VERSION,ACCESS_LEVEL,FORMAT,SECURE);
// Get current standings
    $nflData->standings();

Documentation

### NFL

Go to Sportradar NFL API for full documentation.

NFL API

### SportsDataNfl(api_key,nfl_season,year,week,version,access_level,format,secure)

Instantiate

Arguments

  • api_key - Your API key
  • nfl_season - Preseason (PRE), Regular Season (REG), Postseason (PST)
  • year - Four digit year
  • week - 1 - 17 (Week 0 of Preseason is Hall of Fame game)
  • version - Whole number (sequential, starting with the number 1)
  • access_level - Real-Time (rt), Premium (p), Standard (s), Basic (b), Trial (t)
  • format - Format call will be returned (xml, json)
  • secure - Boolean (true,false) to send on http or https

Example

   $nflData = new SportsDataNfl(YOUR_API_KEY,'REG',2014,16,1,'t','json',false);

### weekly_schedule()

Returns schedule for set week

Example

   $nflData->weekly_schedule();

### season_schedule()

Returns schedule for set season

Example

   $nflData->season_schedule();

### game_statistics(away_team, home_team)

Returns game stats for a given week

Arguments

  • away_team - away team abbreviation
  • home_team - home team abbreviation

Example

   $nflData->game_statistics('BAL','HOU');

### game_summary(away_team, home_team)

Returns game summary for a given week

Arguments

  • away_team - away team abbreviation
  • home_team - home team abbreviation

Example

   $nflData->game_summary('BAL','HOU');

### play_by_play(away_team, home_team)

Returns play by play stats for a game on a given week

Arguments

  • away_team - away team abbreviation
  • home_team - home team abbreviation

Example

   $nflData->play_by_play('BAL','HOU');

### play_summary(away_team, home_team, play_id)

Returns play summary for a given play for a game on a given week

Arguments

  • away_team - away team abbreviation
  • home_team - home team abbreviation
  • play_id - obtained from play_by_play()

Example

   $nflData->play_summary('BAL','HOU','74e0fa3b-1e8d-42b4-ad29-fbe25a2eaea2');

### game_boxscore(away_team, home_team)

Returns game box score for a game on a given week

Arguments

  • away_team - away team abbreviation
  • home_team - home team abbreviation

Example

   $nflData->game_boxscore('BAL','HOU');

### extended_boxscore(away_team, home_team)

Returns extended box score for a game on a given week

Arguments

  • away_team - away team abbreviation
  • home_team - home team abbreviation

Example

   $nflData->extended_boxscore('BAL','HOU');

### weekly_boxscore()

Returns box scores for all games on a given week

Example

   $nflData->weekly_boxscore();

### game_roster(away_team, home_team)

Returns game roster for a game on a given week

Arguments

  • away_team - away team abbreviation
  • home_team - home team abbreviation

Example

   $nflData->game_roster('BAL','HOU');

### team_hierarchy()

Returns team hierarchy

Example

   $nflData->team_hierarchy();

### team_roster(team)

Returns team roster

Arguments

  • team - team abbreviation

Example

   $nflData->team_roster('HOU');

### injuries(away_team, home_team)

Returns injuries for a game on a given week

Arguments

  • away_team - away team abbreviation
  • home_team - home team abbreviation

Example

   $nflData->injuries('BAL','HOU');

### game_depth_chart(away_team, home_team)

Returns depth chart for a game on a given week

Arguments

  • away_team - away team abbreviation
  • home_team - home team abbreviation

Example

   $nflData->game_depth_chart('BAL','HOU');

### team_depth_chart(team)

Returns team depth chart

Arguments

  • team - team abbreviation

Example

   $nflData->team_depth_chart('HOU');

### weekly_league_leaders()

Returns league leaders for a given week

Example

   $nflData->weekly_league_leaders();

### standings()

Returns league standings

Example

   $nflData->standings();

### rankings()

Returns league rankings

Example

   $nflData->rankings();

### seasonal_statistics(team)

Returns seasonal stats for a given team

Arguments

  • team - team abbreviation

Example

   $nflData->seasonal_statistics('HOU');
### MMA

Go to Sportradar MMA API for full documentation.

MMA API

### SportsDataMma(api_key,version,access_level,format,secure)

Instantiate

Arguments

  • api_key - Your API key
  • version - Whole number (sequential, starting with the number 1)
  • access_level - Real-Time (rt), Premium (p), Standard (s), Basic (b), Trial (t)
  • format - Format call will be returned (xml, json)
  • secure - Boolean (true,false) to send on http or https

Example

   $mmaData = new SportsDataMma(YOUR_API_KEY,1,'t','json',false);

### schedule()

Returns upcoming mma fight schedule

Example

   $mmaData->schedule();

### event_results(event_id)

Returns results of specified event

Arguments

  • event_id - unique event id

Example

   $mmaData->event_results('b5ceb386-e8b7-45d7-bd26-49ffff34cd9f');

### participant_list()

Returns list of mma fighters

Example

   $mmaData->participant_list();

### participant_profile(fighter_id)

Returns fighter profile

Arguments

  • fighter_id - unique fighter id

Example

   $mmaData->participant_profile('01b8c502-796d-4fd8-bb44-622b5cd4ac58');

About

PHP wrapper for the Sportradar API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages