定制 itsdizzy/trakt-api 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

itsdizzy/trakt-api

Composer 安装命令:

composer require itsdizzy/trakt-api

包简介

A simple library for the Trakt.tv API v2

README 文档

README

Latest Version on Packagist Software License Total Downloads

This is a library to use the Trakt API in Laravel 5

Setup

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

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

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

Like any laravel library you have to tell laravel how it has to use it.

To do this you have to add the service provider to the providers array in config/app.php

Dizzy\Trakt\TraktServiceProvider::class

You also have to add a facade to the aliases array in config/app.php

'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.

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

TRAKT_CLIENT_ID=yourclientidhere

Now you are all set to use the api.

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.

统计信息

  • 总下载量: 47
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2016-07-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固