{"id":25847543,"url":"https://github.com/dakdevs/php-stream-api","last_synced_at":"2026-05-10T21:42:18.827Z","repository":{"id":62544211,"uuid":"59976775","full_name":"dakdevs/php-stream-api","owner":"dakdevs","description":"PHP API Wrapper for Stream Services such as Twitch.tv and Hitbox.tv. YouTube Gaming coming soon...","archived":false,"fork":false,"pushed_at":"2017-01-26T00:36:17.000Z","size":51,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-15T05:25:05.632Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dakdevs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-30T03:05:13.000Z","updated_at":"2019-10-03T20:13:02.000Z","dependencies_parsed_at":"2022-11-02T21:30:43.180Z","dependency_job_id":null,"html_url":"https://github.com/dakdevs/php-stream-api","commit_stats":null,"previous_names":["dakdevs/php-stream-api"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dakdevs%2Fphp-stream-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dakdevs%2Fphp-stream-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dakdevs%2Fphp-stream-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dakdevs%2Fphp-stream-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dakdevs","download_url":"https://codeload.github.com/dakdevs/php-stream-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241351962,"owners_count":19948759,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-01T10:27:33.304Z","updated_at":"2025-11-26T03:01:56.478Z","avatar_url":"https://github.com/dakdevs.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"PHP API Wrapper for multiple streaming services.\n\n**Note:** Update coming, as Twitch has updated their API making this currently obsolete.\n\n#### Supported Service Providers\n* [Twitch.tv](http://www.twitch.tv)\n* [Hitbox.tv](http://www.hitbox.tv)\n\n## Install via Composer\n\n```shell\n$ composer require vinlock/stream-api\n```\n\n## Usage\n\n### Merging games.\n```php\n$twitch = \\Vinlock\\StreamAPI\\Services\\Twitch::game(\"Dota 2\");\n\n$hitbox = \\Vinlock\\StreamAPI\\Services\\Hitbox::game(\"Dota 2\");\n\n$merge = \\Vinlock\\StreamAPI\\Services\\Service::merge($twitch, $hitbox);\n\necho $merge-\u003egetJSON(); // Displays all streams from highest to lowest viewers for Dota 2 on Twitch and Hitbox.\n```\nMerge as many games as you want...\n```php\n$bladeandsoul_twitch = \\Vinlock\\StreamAPI\\Services\\Twitch::game(\"Blade and Soul\");\n$bladeandsoul_hitbox = \\Vinlock\\StreamAPI\\Services\\Hitbox::game(\"Blade and Soul\");\n$overwatch_twitch = \\Vinlock\\StreamAPI\\Services\\Twitch::game(\"Overwatch\");\n$overwatch_hitbox = \\Vinlock\\StreamAPI\\Services\\Hitbox::game(\"Overwatch\");\n\n$merge = \\Vinlock\\StreamAPI\\Services\\Service::merge(\n    $bladeandsoul_twitch,\n    $bladeandsoul_hitbox, \n    $overwatch_twitch, \n    $overwatch_hitbox\n);\n```\nOr you may pass in the games as an array.\n```php\n$games = [\n    \"Blade and Soul\",\n    \"Overwatch\",\n    \"Aion Online\"\n];\n\n$twitch = \\Vinlock\\StreamAPI\\Services\\Twitch::game($games);\n$hitbox = \\Vinlock\\StreamAPI\\Services\\Hitbox::game($games);\n\n$merge = \\Vinlock\\StreamAPI\\Services\\Service::merge($twitch, $hitbox);\n// or pass the Service Objects as an array to be merged.\n$merge = \\Vinlock\\StreamAPI\\Services\\Service::merge( [ $twitch, $hitbox ] );\n\necho $merge-\u003egetJSON();\n```\n\n### From Usernames\nResults will only show for online users.\n```php\n$twitch = new \\Vinlock\\StreamAPI\\Services\\Twitch(\"vinlockz\");\n$hitbox = new \\Vinlock\\StreamAPI\\Services\\Hitbox(\"vinlock\");\n```\nOr pass many usernames as an array.\n```php\n$twitch_streams = [ \"trick2g\", \"vinlockz\", ... ];\n$hitbox_streams = [ \"hitboxstream1\", \"hitboxstream2\", ... ];\n\n$twitch = new \\Vinlock\\StreamAPI\\Services\\Twitch($twitch_streams);\n$hitbox = new \\Vinlock\\StreamAPI\\Services\\Twitch($hitbox_streams);\n```\nThen merge these as well.\n```php\n$merge = \\Vinlock\\StreamAPI\\Services\\Service::merge($twitch, $hitbox);\n// or\n$merge = \\Vinlock\\StreamAPI\\Services\\Service::merge( [ $twitch, $hitbox ] );\n\necho $merge-\u003egetJSON();     // Displays the information for all streams merged as JSON.\n```\n\n### Universal Merging\nYou may merge instances initialized by usernames with ones initialized by Games.\n```php\n$bladeandsoul_twitch = \\Vinlock\\StreamAPI\\Services\\Twitch::game(\"Blade and Soul\");\n$twitch = new \\Vinlock\\StreamAPI\\Services\\Twitch(\"vinlockz\");\n\n$merge = \\Vinlock\\StreamAPI\\Services\\Service::merge($twitch, $bladeandsoul_twitch);\n\n$merge-\u003egetJSON();\n```\n\n### Data Retrieval\nYou can get an array, JSON, or object from the Service Object.\n```php\necho $merge-\u003egetJSON();     // Displays the information for all streams merged as JSON.\necho $merge-\u003egetArray();    // Array\necho $merge-\u003egetObject();   // Object\n```\n\n## Example JSON\nThis will be universal for every stream provider.\n```json\n[\n    {\n        \"username\": \"trick2g\",\n        \"display_name\": \"Trick2g\",\n        \"game\": \"League of Legends\",\n        \"preview\": {\n            \"small\": \"https://static-cdn.jtvnw.net/previews-ttv/live_user_trick2g-80x45.jpg\",\n            \"medium\": \"https://static-cdn.jtvnw.net/previews-ttv/live_user_trick2g-320x180.jpg\",\n            \"large\": \"https://static-cdn.jtvnw.net/previews-ttv/live_user_trick2g-640x360.jpg\"\n        },\n        \"status\": \"100% Advan | Silver Clown Fiesta 101 How to TDM #Na Throws @Trick2g Day 35 No Sodabull\",\n        \"bio\": \"Opening the Gates\",\n        \"url\": \"https://www.twitch.tv/trick2g\",\n        \"viewers\": 4040,\n        \"id\": 28036688,\n        \"avatar\": \"https://static-cdn.jtvnw.net/jtv_user_pictures/trick2g-profile_image-291046f75304f006-300x300.jpeg\",\n        \"service\": \"twitch\",\n        \"followers\": 996140,\n        \"created_at\": \"05-31-2016 01:15:12\",\n        \"updated_at\": \"05-31-2016 03:36:19\"\n    }\n]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdakdevs%2Fphp-stream-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdakdevs%2Fphp-stream-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdakdevs%2Fphp-stream-api/lists"}