Giter Site home page Giter Site logo

twitch-api's Introduction

SDK for Twitch API

Installation

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

$ composer require TBoileau/twitch-api

Step 2: Install the Twitch Cli

Open a command console, enter your project directory and execute the following command to download the Twitch Cli :

$ php bin/console twitch:install -v 1.1.21 -d Linux_x86_64

Options :

  • --version (or -v) : Pick one of the available versions (default: 1.1.12), you can check all of the available versions here.
  • --distribution (or -d) : Choose the right distribution for your system (Linux_x86_64, Linux_arm64, Darwin_x86_64, Darwin_arm64, Windows_x86_64, Windows_i386).

Usage

Configure the Twitch API environment variables

TWITCH_MOCK_SERVER_PORT=8080 # you can leave it empty if you don't want to use the mock server
TWITCH_API_HOST=https://api.twitch.tv # or http://localhost:8080 if you want to use the mock server
TWITCH_API_BASE_URI=/helix # or /mock if you want to use the mock server
TWITCH_API_CLIENT_ID=your_client_id # you can leave it empty if you use the mock server
TWITCH_API_CLIENT_SECRET=your_client_secret # you can leave it empty if you use the mock server

Start the Twitch mock server (optional)

Open a command console, enter your project directory and execute the following command to start the Twitch mock server :

$ php bin/console twitch:serve

Send a request

<?php

use TBoileau\TwitchApi\Api\TwitchApiFactory;

$twitchApi = TwitchApiFactory::create($accessToken, $_ENV['TWITCH_API_CLIENT_ID']);

$leaderboard = $twitchApi->Bits->getLeaderboard();

twitch-api's People

Contributors

tboileau avatar

Stargazers

Lothereus avatar  avatar Ben Nukem avatar

Watchers

 avatar

twitch-api's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.