PHP code example of vinlock / stream-api

1. Go to this page and download the library: Download vinlock/stream-api 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/ */

    

vinlock / stream-api example snippets


$twitch = \Vinlock\StreamAPI\Services\Twitch::game("Dota 2");

$hitbox = \Vinlock\StreamAPI\Services\Hitbox::game("Dota 2");

$merge = \Vinlock\StreamAPI\Services\Service::merge($twitch, $hitbox);

echo $merge->getJSON(); // Displays all streams from highest to lowest viewers for Dota 2 on Twitch and Hitbox.

$bladeandsoul_twitch = \Vinlock\StreamAPI\Services\Twitch::game("Blade and Soul");
$bladeandsoul_hitbox = \Vinlock\StreamAPI\Services\Hitbox::game("Blade and Soul");
$overwatch_twitch = \Vinlock\StreamAPI\Services\Twitch::game("Overwatch");
$overwatch_hitbox = \Vinlock\StreamAPI\Services\Hitbox::game("Overwatch");

$merge = \Vinlock\StreamAPI\Services\Service::merge(
    $bladeandsoul_twitch,
    $bladeandsoul_hitbox, 
    $overwatch_twitch, 
    $overwatch_hitbox
);

$games = [
    "Blade and Soul",
    "Overwatch",
    "Aion Online"
];

$twitch = \Vinlock\StreamAPI\Services\Twitch::game($games);
$hitbox = \Vinlock\StreamAPI\Services\Hitbox::game($games);

$merge = \Vinlock\StreamAPI\Services\Service::merge($twitch, $hitbox);
// or pass the Service Objects as an array to be merged.
$merge = \Vinlock\StreamAPI\Services\Service::merge( [ $twitch, $hitbox ] );

echo $merge->getJSON();

$twitch = new \Vinlock\StreamAPI\Services\Twitch("vinlockz");
$hitbox = new \Vinlock\StreamAPI\Services\Hitbox("vinlock");

$twitch_streams = [ "trick2g", "vinlockz", ... ];
$hitbox_streams = [ "hitboxstream1", "hitboxstream2", ... ];

$twitch = new \Vinlock\StreamAPI\Services\Twitch($twitch_streams);
$hitbox = new \Vinlock\StreamAPI\Services\Twitch($hitbox_streams);

$merge = \Vinlock\StreamAPI\Services\Service::merge($twitch, $hitbox);
// or
$merge = \Vinlock\StreamAPI\Services\Service::merge( [ $twitch, $hitbox ] );

echo $merge->getJSON();     // Displays the information for all streams merged as JSON.

$bladeandsoul_twitch = \Vinlock\StreamAPI\Services\Twitch::game("Blade and Soul");
$twitch = new \Vinlock\StreamAPI\Services\Twitch("vinlockz");

$merge = \Vinlock\StreamAPI\Services\Service::merge($twitch, $bladeandsoul_twitch);

$merge->getJSON();

echo $merge->getJSON();     // Displays the information for all streams merged as JSON.
echo $merge->getArray();    // Array
echo $merge->getObject();   // Object