2017 © Pedro Peláez
 

library laravel-twitch-restful-api

Laravel twitch api

image

skmetaly/laravel-twitch-restful-api

Laravel twitch api

  • Tuesday, March 31, 2015
  • by skmetaly
  • Repository
  • 3 Watchers
  • 8 Stars
  • 218 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 1 Versions
  • 15 % Grown

The README.md

laravel-twitch-restful-api

Laravel Twittch restful api. An implementation of the twitch restful api V3 provided by Twitch.tv Documentation of the API can be found at Twitch restful api link, (*1)

Installation

Require the package in composer.json :, (*2)

"skmetaly/laravel-twitch-restful-api": "dev-master"

In config/app.php add providers, (*3)

'Skmetaly\TwitchApi\Providers\TwitchApiServiceProvider'

In aliases, (*4)

'TwitchApi'=>'Skmetaly\TwitchApi\Facades\TwitchApiServiceFacade'

Publish the config, (*5)

php artisan vendor:publish --force

Create a twitch application ( in your twitch settings page, Connections tab ) Create a client secret Add both client secret, client id to the twitch-api.php config, (*6)

Change the scopes that the application needs to better suit your needs, (*7)

Usage

The api provides both non-authenticated and authenticated requests, (*8)

Authentication

Twitch api uses OAuth 2.0 protocol for authentication., (*9)

This API uses the Authorization Code Flow., (*10)

First step for authenticating a user is to send him to the twitch authentication URL, (*11)

php public function authenticate() { return Redirect::to(TwitchApi::authenticationURL()); } Keep in mind that the api uses the config set in twitch-api.redirect_url for redirecting after authentication, (*12)

After the user accepted the scopes and authorised your app, it will be redirected at the value set in config('twitch-api.redirect_url'), (*13)

A sample of handling the redirect :, (*14)

```php public function redirect() { $code = Input::get('code');, (*15)

     $token = TwitchApi::requestToken($code);
 }

```, (*16)

You need to persist both the username and token associated with it to use all of the authenticated requests, (*17)

The Versions

31/03 2015

dev-master

9999999-dev

Laravel twitch api

  Sources   Download

MIT

The Requires

 

The Development Requires

by Paul Bele