#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.
5-06-2014:
I have had a project come up that will require my full attention, so if the API updates any time over the next few days or so, I may miss it and be a little late to support the changes. I can also confirm that the video calls to a channel where you are trying to get the past broadcasts does not work. This isn't something on my end, as it does not work properly on either V2 or V3 with the documented param. I will also be removing the GNU-GPL license on the interface and writing a custom one to better define the terms of using the interface as well as completely covering what is and isn't allowed with it. (See the TL`DR, that is the gist of it. I do not care about revenue, only about making sure that the interface is grabbed from here so support can be given and so that the new users can know it is safe)
#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
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. |