Skip to content

A PHP wrapper for the official Fortnite API

License

Notifications You must be signed in to change notification settings

IareTedd/fortnite-api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fortnite-PHP Wrapper

Interact with the official Fortnite API using PHP.

Packagist Packagist

Installation

Pull in the project using composer: composer require iaretedd/fortnite-api

Usage

Create a basic test script to ensure everything was installed properly

<?php

require_once 'vendor/autoload.php';

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

// Authenticate
$auth = Auth::login('epic_email@domain.com','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!';

Friends

$auth = Auth::login('epic_email@domain.com','password');

// Get list of friends
// Params:
//  - boolean $includePending If set to false, friend requests will be removed from output.
var_dump($auth->profile->getFriends());

// Add user to a friendlist
// Params:
// - string $accountId Account Id of a user that you're going to add
$auth->profile->addFriend($accountId);

// Remove user from a friendlist
// Params:
// - string $accountId Account Id of a user that you're going to remove
// Returns int 204 on success
$successfullyRemoved = $auth->profile->removeFriend($accountId) === 204;

Get Leaderboards

$auth = Auth::login('epic_email@domain.com','password');
var_dump($auth->leaderboard->get(Platform::PC, Mode::DUO)); 

Get News

$auth = Auth::login('epic_email@domain.com','password');
var_dump($auth->news->get(News::BATTLEROYALE, Language::ENGLISH)); 

Get Store

$auth = Auth::login('epic_email@domain.com','password');
var_dump($auth->store->get(Language::ENGLISH)); 

Get Challenges

$auth = Auth::login('epic_email@domain.com','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)); 

Constants

Platform [ PC, PS4, XB1 ]

Mode [ SOLO, DUO, SQUAD ]

Language [ ENGLISH, GERMAN, SPANISH, CHINESE, FRENCH, ITALIAN, JAPANESE ]

News [ BATTLEROYALE, SAVETHEWORLD ]

Contributing

Fortnite now utilizes SSL certificate pinning in their Windows client in newer versions. I suggest using the iOS mobile app to do any future API reversing as both cheat protections on the Windows client make it difficult to remove the certificate pinning. If SSL certificate pinning is added to the iOS version, I could easily provide a patch to remove that as the iOS version doesn't contain any anti-cheat.

About

A PHP wrapper for the official Fortnite API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%