PHPackages                             vinlock/stream-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. vinlock/stream-api

ActiveLibrary[API Development](/categories/api)

vinlock/stream-api
==================

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

1.4(9y ago)366MITPHP &gt;=7.0

Since May 30Compare

[ Source](https://github.com/Vinlock/stream-api)[ Packagist](https://packagist.org/packages/vinlock/stream-api)[ Docs](https://github.com/Vinlock/stream-api)[ RSS](/packages/vinlock-stream-api/feed)WikiDiscussions Synced yesterday

READMEChangelog (2)Dependencies (1)Versions (7)Used By (0)

PHP API Wrapper for multiple streaming services.

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

#### Supported Service Providers

[](#supported-service-providers)

- [Twitch.tv](http://www.twitch.tv)
- [Hitbox.tv](http://www.hitbox.tv)

Install via Composer
--------------------

[](#install-via-composer)

```
$ composer require vinlock/stream-api
```

Usage
-----

[](#usage)

### Merging games.

[](#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

[](#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

[](#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

[](#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
------------

[](#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"
    }
]
```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity62

Established project with proven stability

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~17 days

Total

6

Last Release

3597d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bf24573089c4970495a7396f2e29bda2538b464282e0c0fb4fe4bba87d3f41a8?d=identicon)[Vinlock](/maintainers/Vinlock)

---

Tags

streamtwitch.tvhitbox.tv

### Embed Badge

![Health badge](/badges/vinlock-stream-api/health.svg)

```
[![Health](https://phpackages.com/badges/vinlock-stream-api/health.svg)](https://phpackages.com/packages/vinlock-stream-api)
```

###  Alternatives

[razorpay/razorpay

Razorpay PHP Client Library

2045.2M54](/packages/razorpay-razorpay)[get-stream/stream

A PHP client for Stream (https://getstream.io)

1431.3M8](/packages/get-stream-stream)[pubnub/pubnub

This is the official PubNub PHP SDK repository.

1335.1M17](/packages/pubnub-pubnub)[nicklaw5/twitch-api-php

A Twitch API client for PHP.

116239.8k2](/packages/nicklaw5-twitch-api-php)[get-stream/stream-chat

A PHP client for Stream Chat (https://getstream.io/chat/)

301.9M2](/packages/get-stream-stream-chat)[culqi/culqi-php

Cliente Culqi API para PHP

41366.0k1](/packages/culqi-culqi-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
