kfoobar / laravel-sportmonks-soccer
Laravel package for Sportmonks Soccer API v2.0. Fork of kirill-latish/laravel-sportmonks-soccer
Installs: 20
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 41
Open Issues: 2
Type:plugin
Requires
- php: ^7.3|^8.0
- guzzlehttp/guzzle: ^6.5.5|^7.0.1
- illuminate/support: ^7|^8|^9
Requires (Dev)
- fakerphp/faker: ^1.9.1
- laravel/laravel: ^7|^8|^9
- phpunit/phpunit: ^8.5|^9.0
This package is auto-updated.
Last update: 2025-03-21 17:48:36 UTC
README
This package is a wrapper for Sportmonks Soccer API for Laravel 7/8/9.
This is a fork of kirill-latish/laravel-sportmonks-soccer with added support for Larvel 7+.
Installation
Install the package via Composer:
composer require kfoobar/laravel-sportmonks-soccer
Add your API token to your .env
file:
SPORTMONKS_API_TOKEN=
For more settings, you can publish the config file:
$ php artisan vendor:publish --provider="Sportmonks\SoccerAPI\SoccerAPIServiceProvider"
Usage
Example when using the facade:
use SoccerAPI; ... $response = SoccerAPI::leagues()->all(); $response = SoccerAPI::fixtures()->byId($id);
Relations
If you need to include other relations (check the official documentation for which relations can be included):
$response = SoccerAPI::seasons()->setInclude(['league', 'fixtures'])->all();
Response
The default behaviour is to return an object containing a data
array:
$response = SoccerAPI::fixtures()->byId($id); var_dump($response->data);
{ "data": [ { "id": null, "league_id": null, "scores": { "localteam_score": 0, "visitorteam_score": 0 } } ] }
If you want to directly retrieve the properties inside data
, set skip_data
to true
in your config file.
$response = SoccerAPI::fixtures()->byId($id); var_dump($response);
{ "id": null, "league_id": null, "scores": { "localteam_score": 0, "visitorteam_score": 0 } }
Documentation
Please refer to the official documentation as to which API calls can be made.
Contributing
Thank you for considering contributing!