Looking to hire Laravel developers? Try LaraJobs

laravel-soccerama maintained by rebing

Description
Laravel wrapper for Soccerama score API calls v2.0. Fork of rebing/laravel-soccerama
Last update
2019/01/03 09:10 (dev-master)
License
Links
Downloads
1 624

Comments
comments powered by Disqus

Laravel Soccerama

Laravel wrapper for Soccerama (live) score API calls. Documentation for the api can be found here

Installation

1- Require the package via Composer in your composer.json.

{
  "require": {
    "Rebing/laravel-soccerama": "0.1.*"
  }
}

2- Run Composer to install or update the new requirement.

$ composer install

or

$ composer update

3- Add the service provider to your app/config/app.php file

'Rebing\Soccerama\SocceramaServiceprovider',

4- Add the facade to your app/config/app.php file

'Soccerama' => 'Rebing\Soccerama\Facades\Soccerama',

5- Publish the configuration file

$ php artisan vendor:publish --provider="Rebing\Soccerama\SocceramaServiceProvider"

6- Review the configuration file and add your token (preferably through env: 'api_token' => env('API_TOKEN') )

config/graphql.php

Usage

Refer to the official docs as to which calls can be made and check the calls in traits under Rebing\Soccerama\Requests.

For example, get all competitions (if using facade):

use Soccerama;

...

$response = Soccerama::competitions();

The above returns an object containing a data array. If you want to directly retrieve the data within data, change your config file: 'without_data' => true

Get a match by its id:

$response = Soccerama::matchById($id);

If you need to include other relations (check the official docs for which relations can be included):

$include = 'competition,matches';
// Or: $include = ['competition', 'matches'];

$response = Soccerama::setInclude($include)->seasons();