axl-media-org/sportradar-sdk

PHP-based SDK to work with the Sportradar API & live events.

0.3.0 2021-02-08 12:09 UTC

README

CI codecov StyleCI Latest Stable Version Total Downloads Monthly Downloads License

Sportradar SDK is a PHP-based SDK to work with the Sportradar API & live events.

🚀 Installation

You can install the package via composer:

composer require axl-media-org/sportradar-sdk

Publish the config:

$ php artisan vendor:publish --provider="AxlMedia\SportradarSdk\SportradarSdkServiceProvider" --tag="config"

🙌 Usage

Laravel

use AxlMedia\SportradarSdk\Facades\Facade as Sportradar;

$summaries = Sportradar::sport('soccer')
    ->sportEvents()
    ->from('summaries')
    ->getLiveSummaries();

while ($summaries->parseable()) {
    foreach ($summaries->getContent() as $match) {
        foreach ($match['sport_event']['competitors'] as $team) {
            //
        }
    }

    $summaries = $summaries->next();
};

PHP

use AxlMedia\SportradarSdk\SoccerV4;

// The key is the access_level and the value is the actual API key.
SoccerV4::keys([
    'production' => 'some-key',
    'trial' => 'some-key',
]);

$summaries = (new SoccerV4)
    ->sportEvents()
    ->from('summaries')
    ->getLiveSummaries();

while ($summaries->parseable()) {
    foreach ($summaries->getContent() as $match) {
        foreach ($match['sport_event']['competitors'] as $team) {
            //
        }
    }

    $summaries = $summaries->next();
};

Full API

🐛 Testing

vendor/bin/phpunit

🤝 Contributing

Please see CONTRIBUTING for details.

🎉 Credits