2017 © Pedro Peláez
 

library trakt-api

A simple library for the Trakt.tv API v2

image

itsdizzy/trakt-api

A simple library for the Trakt.tv API v2

  • Wednesday, September 27, 2017
  • by ItsDizzy
  • Repository
  • 1 Watchers
  • 1 Stars
  • 35 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Trakt API for Laravel 5

Latest Version on Packagist ![Software License][ico-license] Total Downloads, (*1)

This is a library to use the Trakt API in Laravel 5, (*2)

Setup

To install this library you need to use composer, you can get it from here., (*3)

When you have that installed which you probably already have since you already made a laravel project, you can run the following command:, (*4)

composer require itsdizzy/trakt-api 1.0.x-dev

Like any laravel library you have to tell laravel how it has to use it., (*5)

To do this you have to add the service provider to the providers array in config/app.php, (*6)

Dizzy\Trakt\TraktServiceProvider::class

You also have to add a facade to the aliases array in config/app.php, (*7)

'Trakt' => Dizzy\Trakt\Facades\Trakt::class,

Now laravel knows which bindings it has to create and which config files it has to load, and it made a nice little alias so you can just use the Trakt facade in your code., (*8)

Trakt also requires at least a api key, you can get one by creating a new application here. Now open your .env file and add set the TRAKT_CLIENT_ID with your client id, (*9)

TRAKT_CLIENT_ID=yourclientidhere

Now you are all set to use the api., (*10)

Usage

<?php

namespace App\Http\Controllers;

use Trakt;

class MoviesController extends Controller
{
    /**
     * @param $id
     * @return array
     */
    public function getMovie($id)
    {
        $movie = Trakt::movies()->withImages()->get($id);

        return [
            'movie' => $movie->toArray(),
            'people' => $movie->people(),
            'releases' => $movie->releases()
        ];
    }
}

A better explanation will come soon., (*11)

The Versions

27/09 2017

dev-master

9999999-dev https://github.com/ItsDizzy/trakt-api-laravel

A simple library for the Trakt.tv API v2

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

by Dizzy

17/07 2016

v1.0

1.0.0.0 https://github.com/ItsDizzy/trakt-api-laravel

A simple library for the Trakt.tv API v2

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

by Dizzy