PHP code example of tustin / fortnite-php

1. Go to this page and download the library: Download tustin/fortnite-php 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/ */

    

tustin / fortnite-php example snippets




ortnite\Auth;
use Fortnite\Account;
use Fortnite\Mode;
use Fortnite\Language;
use Fortnite\Platform;

// Authenticate
$auth = Auth::login('[email protected]','password');

// Output each stat for all applicable platforms
var_dump($auth->profile->stats);

// Grab someone's stats
$sandy = $auth->profile->stats->lookup('sandalzrevenge');
echo 'Sandy Ravage has won ' . $sandy->pc->solo->wins . ' solo games and ' . $sandy->pc->squad->wins . ' squad games!';

$auth = Auth::login('[email protected]','password');
var_dump($auth->leaderboard->get(Platform::PC, Mode::DUO)); 


$auth = Auth::login('[email protected]','password');
var_dump($auth->news->get(News::BATTLEROYALE, Language::ENGLISH)); 

$auth = Auth::login('[email protected]','password');
var_dump($auth->store->get(Language::ENGLISH)); 

$auth = Auth::login('[email protected]','password');
// All weekly challenges
var_dump($auth->profile->challenges->getWeeklys()); 

// Or just get a specific week (in this example, week 1)
var_dump($auth->profile->challenges->getWeekly(1));