Download the PHP package ylorant/twitch-php-client without Composer

On this page you can find all versions of the php package ylorant/twitch-php-client. 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-php-client

Twitch PHP Client

FOSSA Status

This library is a PHP client for the Twitch APIs. It will allow you to send requests to Twitch easily, using authentication or not, with a simple design that allows embedding into services. It also relies on as few PHP dependencies as possible, it only needs the cURL extension to be installed, and depends on psr/log for its LoggerInterface.

Compatibility : PHP 7.0+

Note: this library is still quite incomplete API-wise. Those will be added progressively. You can still add functionality quite easily though by adding to the already existing endpoints or by creating missing endpoints. If then you want to contribute it back to the project, just do a pull request :)

Install

Using composer:

Basic usage (using Helix)

For more info about token providers and authentication, see the next section.

Authentication: getting tokens

For some write operations, Twitch requires you to use an access token linked to the entity you want to edit. For this purpose, there's an API available to request access tokens to specific user accounts (using the "Authorize app" page you might have seen already) with multiple authentication workflows.

This library provides a way to fetch tokens using the OAuth Authorization code workflow. Here is a sample code that would work to fetch an access token. You can see another example in the file tests/authentication.php.

The TokenProvider interface

Twitch API relies on user and app authentication to allow access to its API (OAuth2), so to account for that, this library uses a simple interface called the TokenProvider (at TwitchClient\Authentication\TokenProvider). This interface describes how the library will retrieve app and user authentication.

You can choose to implement your own token provider by creating an object implementing the TokenProvider interface, in case you need to store specifically your user tokens, or, if you use a more basic workflow that needs to set the tokens once, you can use the DefaultTokenProvider to implement a standard token provider functionality to the client. This default provider however will only save tokens in variables, so you won't have any persistence.

The token provider works on a basic principle. You can register a set of tokens for a defined "target" channel. The targeted channel can be different from the one you create a token with. Then, when you call an api method that will require some level of access, the library will try to fetch the tokens for the targetted channel. If the token has expired, the library will try to refresh it.

When no targeted channel is needed, there is 2 cases that will happen to provide authentication :

Testing

Before testing, you need to install development dependencies :

This will install phpunit, Faker and Monolog to ensure debbuging logs, fake data and the testing framework itself.

To test the app, duplicate and rename the phpunit.xml.dist file and rename it to phpunit.xml, then fill out in it the info relative to the app credentials (you can use the tests/authentication.php file to generate an access token). Once this is done, you can start tests using the phpunit command.

License

FOSSA Status


All versions of twitch-php-client with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0.0
ext-curl Version *
psr/log Version ^1.0
fakerphp/faker Version ^1.19
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 ylorant/twitch-php-client contains the following files

Loading the files please wait ....