HOW-TO
Implementation
require('twitch_status_tool.php');
$yourChannelName = new StreamerStatus("YourChannelName");
$yourChannelNameStatus = $yourChannelName->returnLiveStatus(); // result: "online" or "offline"
More detailed informations for Streams, that are online:
Easily get detailed stream informations such as Gamename, Streamtitle, Viewer Count, Thumbnail URL and many more!
$streamInfos = $stream->returnStreamInfos();
echo $streamGame = $streamInfos['game_name']; // Returns the Game Name
// instead of "game_name" you can also use one of the following values:
// id, user_id, user_login, game_id, game_name, type, title, viewer_count, started_at, language, thumbnail_url, tag_ids, is_mature
Requirements
- PHP Version: at least v5.6 - but v7 and higher is recommended
- Server needs to have permissions to read and write to the config-File
- cURL needs to be enabled in the php.ini / allowed on the server
The Twitch Stream Status Tool uses an App Access Token and the Client credentials flow - for more informations refer to the documentation:
https://dev.twitch.tv/docs/authentication#types-of-tokens
This script is based on the new Twitch API (2020). The previous Twitch API was v5 / KRAKEN (deprecated).