#Twitch Interface
[PHP] Twitch Interface
This is a universal PHP interface designed specifically to connect to and interact with the twitch.tv Kraken API servers. It was designed with the intention of being very controlled, safe and light for both the user server and the Kraken API servers. Almost, if not all capable calls are coded directly into the interface, allowing the interface to perform almost, if not all functions that the API allows. Any functions that you believe need to be added or improved can be done via a pull request or opening up an issue.
Currently this interface supports all V3 API calls.
2-15-2014:
The API is fully covered as far as V3 of Twitch's Kraken API is documented or as far as I feel needs to be supported (I have no intention of supporting either depreciated or unofficial API endpoints). This does not mean I will no longer work on this and as soon as anything on the API changes/becomes avaiable, I will update the interface accordingly.
#License
This Twitch Interface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This Twitch Interface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
A copy of the GNU GPLV3 license can be found at http://www.gnu.org/licenses/
or can be found in the folder distributed with the software.
###TL`DR
You can do whatever you want with this piece of software, including modifying it and using it in any way, shape or form. The only requirement is that you keep the credit and the license in the header of the file itself and that you not, in any circumstances redistribute the file in question for the safety of any people who wish to use this software. If you wish to have other people use this software, it is best that you give them the link to this particular git for the latest version of this software and to allow them to find all of the information relating to this piece of software.
For any information about the interface, please look in the module list below (Yes, I know PHP does not actually have a module system, it is just easier to sort them by this).
- Encompass all currently documented API endpoints available in Twitch's kraken V3
- Very simple calls:
$editors = $interface->getEditors('test_channel_1', -1, 0, 'Your OAuth Token', 'Your Access Code');
- Able to grab theoretically unlimited information
- Automatically adds your client-id into the header of every call to avoid rate limits (Don't abuse twitch though, they still reserve the right to rate limit you or even deny your application access. I take no responsibility for any actions Twitch may or may not take in order to stop abuse of the API)
- Automatically uses a defined certificate for true HTTPS (Has a workaround in case a certificate is not provided to allow calls to go through properly)
- Extremely configurable (See configuration)
- Very light weight both in CPU usage and in memory usage (Developed with a single core system in mind [My machine is single core])
- Easy to use returns (Everything is either an array or a bool for ease of use for novice and starting developers)
- Checks on all authenticated calls (Will go as far as to validate that a token has the required scope for the call before attempting it)
- Complete function walkthrough output and error output (See Output)
- Built on base calls for dependencies (cURL and JSON Utilities), allowing base versions to be used.
- Easy to install (Composer compatibility will be built in once first port is completed)
Call |
Description |
getFollowers() |
Grabs a list of the users following the specified channel. |
getFollows() |
Grabs a list of the channels followed by a specified user. |
followChan() |
Attempts to add a target channel to a subject users follows list. |
unfollowChan() |
Attempts to remove a target channel from a subject users follows list. |
Call |
Description |
getLargestGame() |
Attempts to grab a list of all games currently streamed in order of current viewers (descending) |
Call |
Description |
getURLParamValue() |
Retrieves the value of a passed parameter in a URL string, positionally insensitive. |
getURLParams() |
Grabs an array of all URL parameters and values. |
get_iterated() |
This function iterates through calls. |
Call |
Description |
getIngests() |
Grabs All currently registered Ingest servers and some base stats |
Call |
Description |
generateError() |
Handles output for all errors encountered by the interface. Almost all error output is authentication issues. |
generateOutput() |
Handles all function output, including function init and walkthrough. Refer to the output config for more information. |
Call |
Description |
searchGameCat() |
Searches Twitch's list of all games for the matching string. |
Call |
Description |
getTeams() |
Gets the team objects for all active teams. |
getTeam() |
Grabs the team object for the supplied team. |
Call |
Description |
getUserObject() |
Grabs an unauthenticated user object for the supplied username. |
getUserObject_Authd() |
Grabs an authenticated user object for the supplied username. Contains some sensitive data. |