Download the PHP package raideer/twitch-api without Composer

On this page you can find all versions of the php package raideer/twitch-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package twitch-api

Latest Stable Version Total Downloads Latest Unstable Version License StyleCI

Twitch API wrapper in PHP

  1. Installation
  2. Basic usage
  3. Authenticated requests
  4. Resources

Installation

composer require raideer/twitch-api

Usage

Basic, unauthenticated requests.

First we need to create the main Wrapper instance. The constructor takes a Guzzle Client as its only parameter.

Now we can access various Twitch API resources using the wrapper.
You can see all the resources and their methods here:
https://github.com/raideer/twitch-api/blob/master/resources.md
https://github.com/justintv/Twitch-API#index

Note: letter capitalization desn't matter, so $wrapper->CHANNELS->getChannel() will still work.

Some methods can take an optional array of parameters.
See the official twitch api documentation for the list of parameters.

Authenticated requests

First we need to create an OAuth object, that will contain the necessary information for authenticating our requests.

Read more about authentication here.

Once the user authorizes your application, they will be redirected to your specified URI with a code, that's necessary for obtaining the access token.

Obtaining the Access Token

You can obtain the access token by using the getResponse method. If the request is successful, OAuthResponse object will be returned. It contains the access token, refresh token and registered scopes.

Now you can authorize the Wrapper using the authorize method.

If you authorize the wrapper only by passing the access token, the Wrapper will not be able to check whether the scope you're trying to access actually exists. (Useful if you don't want to make unnecessary requests)

Now you can make authorized requests.

If the request is out of scope, Raideer\TwitchApi\Exceptions\OutOfScopeException will be thrown.

Throttling (under construction)

If you need, you can enable request throttling.

Time (milliseconds) between requests can be set like so:

Examples

Resources and their methods


All versions of twitch-api with dependencies

PHP Build Version
Package Version
Requires guzzlehttp/guzzle Version 6.*
symfony/options-resolver Version 3.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package raideer/twitch-api contains the following files

Loading the files please wait ....