承接 vinlock/stream-api 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

vinlock/stream-api

Composer 安装命令:

composer require vinlock/stream-api

包简介

PHP API Wrapper for Stream Services such as Twitch.tv and Hitbox.tv

README 文档

README

PHP API Wrapper for multiple streaming services.

Note: Update coming, as Twitch has updated their API making this currently obsolete.

Supported Service Providers

Install via Composer

$ composer require vinlock/stream-api

Usage

Merging games.

$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.

Merge as many games as you want...

$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
);

Or you may pass in the games as an array.

$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();

From Usernames

Results will only show for online users.

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

Or pass many usernames as an array.

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

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

Then merge these as well.

$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.

Universal Merging

You may merge instances initialized by usernames with ones initialized by Games.

$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();

Data Retrieval

You can get an array, JSON, or object from the Service Object.

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

Example JSON

This will be universal for every stream provider.

[
    {
        "username": "trick2g",
        "display_name": "Trick2g",
        "game": "League of Legends",
        "preview": {
            "small": "https://static-cdn.jtvnw.net/previews-ttv/live_user_trick2g-80x45.jpg",
            "medium": "https://static-cdn.jtvnw.net/previews-ttv/live_user_trick2g-320x180.jpg",
            "large": "https://static-cdn.jtvnw.net/previews-ttv/live_user_trick2g-640x360.jpg"
        },
        "status": "100% Advan | Silver Clown Fiesta 101 How to TDM #Na Throws @Trick2g Day 35 No Sodabull",
        "bio": "Opening the Gates",
        "url": "https://www.twitch.tv/trick2g",
        "viewers": 4040,
        "id": 28036688,
        "avatar": "https://static-cdn.jtvnw.net/jtv_user_pictures/trick2g-profile_image-291046f75304f006-300x300.jpeg",
        "service": "twitch",
        "followers": 996140,
        "created_at": "05-31-2016 01:15:12",
        "updated_at": "05-31-2016 03:36:19"
    }
]

统计信息

  • 总下载量: 66
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-05-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固