Skip to content

smashgg/Twitch-SDK

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TwitchTV SDK for PHP

This is unofficial TwitchTV SDK for PHP. SDK is currently under development, so functions, readme and/or examples will change.

Development

TwitchTV SDK for v3 API is under development

There is develop branch, which takes place in refactoring existing features. Because I need to develop SDK and also have it functional, rewriting functions carried out in phases. If you have questions or suggestions regarding the development of the new version, you can use Issues

WARNING FOR 2.* !!!

Version 2.* changed namespace! I know it's not best practice and i'm really sorry, but i have my reasons for that. Thanks for understanding. Version 2.* has BC breaks and lot of changes. Be careful with updating! Before updating thoroughly examine the changes and adjust your application for modified functions.

Requirements

TwitchTV SDK for PHP requires PHP 5.3.0 or later with cURL.

Installation

The best way to install TwitchTV SDK is use Composer.

Download the bundle using Composer

$ composer require 'ritero/twitch-sdk:~1.0'

Or add bundle to your composer.json file

{
    "require": {
        // ..
        "ritero/twitch-sdk": "~1.0"
    }
}

The downloaded package includes the src directory. This directory contains the source code of TwitchTV SDK for PHP. This is the only directory that you will need in order to deploy your application.

Getting started

Basic functions starts with standard naming policy (user*, channel* etc.) - userGet() for example. Authenticated functions have auth* prefixes, like authUserGet().

SDK initialization in your project

With autoloader (Frameworks etc.)

use \ritero\SDK\TwitchTV\TwitchSDK;

$twitch = new TwitchSDK;
...

Without Autoloader

require '/path/to/libs/ritero/SDK/TwitchTV/TwitchSDK.php';
require '/path/to/libs/ritero/SDK/TwitchTV/TwitchException.php';

use \ritero\SDK\TwitchTV\TwitchSDK;
use \ritero\SDK\TwitchTV\TwitchException;

$twitch = new TwitchSDK;
...

Usage

Basic usage (public functions only)

$twitch = new TwitchSDK;
$channel = $twitch->channelGet('channelname');
...

Authenticated functions usage

$twitch_config = array(
    'client_id' => 'your_twitch_app_client_id',
    'client_secret' => 'your_twitch_app_client_secret',
    'redirect_uri' => 'your_twitch_app_redirect_uri',
);

$twitch = new TwitchSDK($twitch_config);
$loginURL = $twitch->authLoginURL('user_read');
...

More examples you can find soon at Wiki pages.

Licenses

Refer to the LICENSE.md file for license information

Reference

TwitchTV SDK, TwitchTV, TwitchTV API, Composer

About

TwitchTV API SDK for PHP

Resources

License

Stars

1 star

Watchers

20 watching

Forks

Packages

 
 
 

Contributors

Languages

  • PHP 100.0%