PHP code example of langleyfoxall / press-association-tv-api-wrapper

1. Go to this page and download the library: Download langleyfoxall/press-association-tv-api-wrapper 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/ */

    

langleyfoxall / press-association-tv-api-wrapper example snippets


$client = new \LangleyFoxall\PressAssociationTvApi\Client('API_KEY');

$channel = $client->getChannel('da015cc7-a71e-3137-a110-30dc51262eef');

$channels = $client->getChannels([
    'da015cc7-a71e-3137-a110-30dc51262eef',
    '3b205a49-a866-32a0-b391-c727d52b1e79',
    '7cd38a6c-bb1f-306a-a6c6-00c7f7558432',
]);

object(LangleyFoxall\PressAssociationTvApi\Objects\Channel)#1804 (2) {
  ["title"]=>
  string(20) "Sky Sports Action HD"
  ["images"]=>
  object(Illuminate\Support\Collection)#1803 (1) {
    ["items":protected]=>
    array(1) {
      [0]=>
      object(stdClass)#1800 (2) {
        ["kind"]=>
        string(12) "picture:logo"
        ["rendition"]=>
        object(stdClass)#1801 (3) {
          ["default"]=>
          object(stdClass)#1798 (1) {
            ["href"]=>
            string(43) "http://tv.static.press.net/logo/p329131.png"
          }
          ["transparent-light"]=>
          object(stdClass)#1794 (1) {
            ["href"]=>
            string(50) "http://tv.static.press.net/logo/p2201707181414.png"
          }
          ["transparent-dark"]=>
          object(stdClass)#1795 (1) {
            ["href"]=>
            string(50) "http://tv.static.press.net/logo/p1201707181414.png"
          }
        }
      }
    }
  }
}

$schedule = $client->getScheduleForToday([
    'da015cc7-a71e-3137-a110-30dc51262eef',
    '3b205a49-a866-32a0-b391-c727d52b1e79',
    '7cd38a6c-bb1f-306a-a6c6-00c7f7558432',
]);

$tomorrowSchedule = $client->getScheduleForDay([
        'da015cc7-a71e-3137-a110-30dc51262eef',
        '3b205a49-a866-32a0-b391-c727d52b1e79',
        '7cd38a6c-bb1f-306a-a6c6-00c7f7558432',
    ], \Carbon\Carbon::now()->addDay());

$items = $schedule->all();

$items = $schedule->getByGenre('Football');

object(LangleyFoxall\PressAssociationTvApi\Objects\ScheduleItem)#1542 (5) {
  ["title"]=>
  string(27) "Hockey: China v Netherlands"
  ["episodeTitle"]=>
  string(27) "Hockey: China v Netherlands"
  ["dateTime"]=>
  object(Carbon\Carbon)#1538 (3) {
    ["date"]=>
    string(26) "2018-07-27 23:00:00.000000"
    ["timezone_type"]=>
    int(1)
    ["timezone"]=>
    string(6) "+00:00"
  }
  ["channel"]=>
  object(LangleyFoxall\PressAssociationTvApi\Objects\Channel)#1533 (2) {
    ["title"]=>
    string(10) "BT Sport 2"
    ["images"]=>
    object(Illuminate\Support\Collection)#1534 (1) {
      ["items":protected]=>
      array(1) {
        [0]=>
        object(stdClass)#1531 (2) {
          ["kind"]=>
          string(12) "picture:logo"
          ["rendition"]=>
          object(stdClass)#1532 (3) {
            ["default"]=>
            object(stdClass)#1529 (1) {
              ["href"]=>
              string(43) "http://tv.static.press.net/logo/p388708.png"
            }
            ["transparent-light"]=>
            object(stdClass)#1530 (1) {
              ["href"]=>
              string(50) "http://tv.static.press.net/logo/p2201805121806.png"
            }
            ["transparent-dark"]=>
            object(stdClass)#1506 (1) {
              ["href"]=>
              string(50) "http://tv.static.press.net/logo/p1201805121806.png"
            }
          }
        }
      }
    }
  }
  ["genres"]=>
  object(Illuminate\Support\Collection)#1535 (1) {
    ["items":protected]=>
    array(1) {
      [0]=>
      string(6) "hockey"
    }
  }
}