tustin/fortnite-php

此包已被废弃且不再维护。未建议任何替代包。

Fortnite官方API的PHP包装器。

0.0.9 2018-12-12 01:03 UTC

This package is auto-updated.

Last update: 2020-03-24 23:12:45 UTC


README

使用PHP与官方Fortnite API交互。

Packagist Packagist

安装

使用composer拉取项目: composer require Tustin/fortnite-php

用法

创建一个基本的测试脚本以确保一切安装正确

<?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!';

获取排行榜

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

获取新闻

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

获取商店

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

获取挑战

$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)); 

常量

Platform [ PC, PS4, XB1 ]

Mode [ SOLO, DUO, SQUAD ]

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

News [ BATTLEROYALE, SAVETHEWORLD ]

贡献

Fortnite现在在新版本Windows客户端中使用了SSL证书固定。我建议使用iOS移动应用进行任何未来的API反向工程,因为Windows客户端的作弊保护使得移除证书固定变得困难。如果iOS版本添加了SSL证书固定,我可以轻松提供一个补丁来移除它,因为iOS版本不包含任何反作弊。