PHP code example of nkl-kst / the-sports-db

1. Go to this page and download the library: Download nkl-kst/the-sports-db library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nkl-kst / the-sports-db example snippets


// You need to load the Composer autoload file somewhere in your code before
ClientFactory::create();

// Get soccer livescores
$livescores = $client->livescore()->now('Soccer');
echo $livescores[0]->strProgress;

// Get video highlights
$highlights = $client->highlight()->latest();
echo $highlights[0]->strVideo;

// Get next events for Liverpool FC
$events = $client->schedule()->teamNext(133602);
echo $events[0]->strEvent;

use NklKst\TheSportsDb\Client\ClientFactory;

// Set an API key
$client = ClientFactory::create();
$client->configure()->setKey('YOUR_API_KEY');

use NklKst\TheSportsDb\Client\ClientFactory;

// Use the default rate limit of 100 requests per minute
$client = ClientFactory::create();
$client->configure()->setRateLimiter();

// Do your requests as usual

// You can unset the rate limiter later
$client->configure()->unsetRateLimiter();