PHP Classes

NBA PHP API Balldontlie Service: Get NBA games and players with Balldontlie API

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 13 All time: 11,383 This week: 524Up
Version License PHP version Categories
balldontlie-service 1.0The PHP License5PHP 5, Games, Web services
Description 

Author

This package is specific mainly for applications used in United States United States .

This package can get NBA games and players with Balldontlie API.

It can send HTTP requests to the Balldontlie API Web server to request information about several details about the NBA (National Basketball Association of United States).

Currently, it can:

- Get details of a given player

- Get details about a given team

- Get details about a game

- Get several statistics from the NBA

Picture of Hicri
  Performance   Level  
Name: Hicri <contact>
Classes: 26 packages by
Country: Turkey Turkey
Age: 30
All time rank: 291048 in Turkey Turkey
Week rank: 178 Up2 in Turkey Turkey Up
Innovation award
Innovation award
Nominee: 4x

Winner: 1x

Details

slvler - balldontlie Service

tests Latest Stable Version Latest Unstable Version License

This package provides a convenient wrapper to the Balldontlie API for Laravel applications.

Requirements

  • PHP 8.0+
  • Laravel 9.x

Installation

To install this package tou can use composer:

    composer require slvler/balldontlie-laravel

Usage

Find player

Balldontlie::players(237);

it returns an json with player:

{
  "data":[
    {
      "id":237,
      "first_name":"LeBron",
      "last_name":"James",
      "position":"F",
      "height_feet": 6,
      "height_inches": 8,
      "weight_pounds": 250,
      "team":{
        "id":14,
        "abbreviation":"LAL",
        "city":"Los Angeles",
        "conference":"West",
        "division":"Pacific",
        "full_name":"Los Angeles Lakers",
        "name":"Lakers"
      }
    }
    ...
 ],
 "meta": {
    "total_pages": 50,
    "current_page": 1,
    "next_page": 2,
    "per_page": 25,
    "total_count": 9999
  }
}   

Find team

Balldontlie::teams(14);

it returns an json with team:

{
  "data": [
    {
      "id":14,
      "abbreviation":"LAL",
      "city":"Los Angeles",
      "conference":"West",
      "division":"Pacific",
      "full_name":"Los Angeles Lakers",
      "name":"Lakers"
    },
    ...
  ],
  "meta": {
    "total_pages": 1,
    "current_page": 1,
    "next_page": null,
    "per_page": 30,
    "total_count": 30
  }
}

Find games

Balldontlie::games(1);

it returns an json with games:

{
  "data": [
    {
      "id":1,
      "date":"2018-10-16T00:00:00.000Z",
      "home_team_score":105,
      "visitor_team_score":87,
      "season":2018,
      "period": 4,
      "status": "Final",
      "time": " ",
      "postseason": false,
      "home_team":{
        "id":2,
        "abbreviation":"BOS",
        "city":"Boston",
        "conference":"East",
        "division":"Atlantic",
        "full_name":"Boston Celtics",
        "name":"Celtics"
      },
      "visitor_team":{
        "id":23,
        "abbreviation":"PHI",
        "city":"Philadelphia",
        "conference":"East",
        "division":"Atlantic",
        "full_name":"Philadelphia 76ers",
        "name":"76ers"
      },
    },
    ...
  ],
  "meta": {
    "total_pages": 1877,
    "current_page": 1,
    "next_page": 2,
    "per_page": 25,
    "total_count": 46911
  }
}

Find stats

Balldontlie::stats();

it returns an json with stats:

{
  "data": [
    {
      "id":29,
      "ast":2,
      "blk":2,
      "dreb":8,
      "fg3_pct":0.25,
      "fg3a":4,
      "fg3m":1,
      "fg_pct":0.429,
      "fga":21,
      "fgm":9,
      "ft_pct":0.8,
      "fta":5,
      "ftm":4,
      "game":{
        "id":1,
        "date":"2018-10-16T00:00:00.000Z",
        "home_team_id":2,
        "home_team_score":105,
        "season":2018,
        "visitor_team_id":23,
        "visitor_team_score":87
      },
      "min":"36:49",
      "oreb":2,
      "pf":3,
      "player":{
        "id":145,
        "first_name":"Joel",
        "last_name":"Embiid",
        "position":"F-C",
        "team_id":23
      },
      "pts":23,
      "reb":10,
      "stl":1,
      "team":{
        "id":23,
        "abbreviation":"PHI",
        "city":"Philadelphia",
        "conference":"East",
        "division":"Atlantic",
        "full_name":"Philadelphia 76ers",
        "name":"76ers"
      },
      "turnover":5
    },
    ...
  ],
  "meta": {
    "total_pages": 2042,
    "current_page": 1,
    "next_page": 2,
    "per_page": 25,
    "total_count": 51045
  }
}

Testing

    composer test

Credits

License

The MIT License (MIT). Please see License File for more information.

Contributing

You're very welcome to contribute. Please see CONTRIBUTING for details.


  Files folder image Files (15)  
File Role Description
Files folder image.github (1 directory)
Files folder imageconfig (1 file)
Files folder imagesrc (4 files, 1 directory)
Files folder imagetests (2 directories)
Accessible without login Plain text file .styleci.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE.md Lic. License text
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file phpunit.xml.dist Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (15)  /  .github  
File Role Description
Files folder imageworkflows (1 file)

  Files folder image Files (15)  /  .github  /  workflows  
File Role Description
  Accessible without login Plain text file tests.yml Data Auxiliary data

  Files folder image Files (15)  /  config  
File Role Description
  Accessible without login Plain text file balldontlie.php Aux. Auxiliary script

  Files folder image Files (15)  /  src  
File Role Description
Files folder imageFacades (1 file)
  Plain text file Balldontlie.php Class Class source
  Plain text file BalldontlieApiWrapper.php Class Class source
  Plain text file BalldontlieServiceProvider.php Class Class source
  Plain text file HttpResponse.php Class Class source

  Files folder image Files (15)  /  src  /  Facades  
File Role Description
  Plain text file Balldontlie.php Class Class source

  Files folder image Files (15)  /  tests  
File Role Description
Files folder imageFeature (1 file)
Files folder imageUnit (1 file)

  Files folder image Files (15)  /  tests  /  Feature  
File Role Description
  Plain text file BalldontlieTest.php Class Class source

  Files folder image Files (15)  /  tests  /  Unit  
File Role Description
  Plain text file TestCase.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:13
This week:0
All time:11,383
This week:524Up