PHP code example of wubs / trakt

1. Go to this page and download the library: Download wubs/trakt library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

wubs / trakt example snippets


  Route::get(
     '/',
     function (\Wubs\Trakt\Trakt $trakt) {
         dump($trakt->movies->popular());
     }
 );

 
 $provider = new TraktProvider($clientId, $clientSecret, $redirectUrl);
 $auth = new Auth($provider);
 

$trakt = new Trakt($auth);


$trakt->auth->authorize();



//... initiate Auth

$auth = $trakt->auth->authorize();

//route: trakt/auth
$token = $trakt->auth->token($_GET['code']);



//initialize Auth here...

$trakt = new Trakt($auth);
$token = $trakt->auth->createToken($token, $type, $expires, $refresh, $scope);

$settings = $trakt->users->settings($token);
$comment = $trakt->comments->get($commentId);
$movie = $trakt->search->byId($type, $id);
$movie = $trakt->search->byId($type, $id, $token); //can be with, or without token.


$trakt->movies->page(2)->collected(); //this will get the second page of the /movies/collected endpoint
//when you want to specify a limit
$trakt->movies->page(2)->limit(15)->collected(); //this will give you the second page, with 15 items



$trakt->movies->withImages()->collected();//this will give you all kinds of extra images
//or
$trakt->movies->withFull()->collected(); //this will give you a lot of extra data


$response = trakt->movies
    ->page(2)
    ->withImages()
    ->withFull()
    ->limit(20)
    ->collected();