varandas / fortnite-api
v1.0.0
2019-08-21 17:11 UTC
Requires
- php: >=7.2
- ext-curl: *
- ext-json: *
Requires (Dev)
- squizlabs/php_codesniffer: 3.4.2
This package is auto-updated.
Last update: 2023-01-27 14:53:47 UTC
README
遗憾的是,fortniteapi.com背后的团队已转移到另一个项目,使这个包装器过时。
但是,现在在 https://fortnite-api.com/ 有一个新API,还有一个PHP包装器,链接为 https://github.com/Fortnite-API/php-wrapper
FortniteAPI.com
这是一个 https://fortniteapi.com/ API的包装器。
Fortnite API(获取玩家统计信息 WITH STATS V2,排行榜等)
您可以使用此API获取用户胜利、击杀、最新新闻、fortnite服务器状态等更多信息。
关于
这是一个 更新版 的 https://github.com/samhoogantink/Fortnite-API 包装器。API已更改,现在大多数端点都需要访问令牌,因此我已做出必要的更改并添加了新端点。
您可以在此处查看可用的端点 https://docs.fortniteapi.com/?version=latest
要求
- Composer https://getcomposer.org/
- 授权密钥。您可以在 https://console.fortniteapi.com/ 免费获取一个。
安装
使用以下命令安装: composer require varandas/fortnite-api && composer dump-autoload --optimize
使用方法
<?php // Require autoload require 'vendor/autoload.php'; use Varandas\FortniteApi\FortniteClient; // Get an instance of FortniteClient $api = new FortniteClient(); $api->setKey("your api key"); /** ITEMS API **/ // Get the daily store $data = $api->items->store(); // Get upcoming items $data = $api->items->upcoming(); // List items $data = $api->items->list(); // Get a random item $data = $api->items->random(); // Get a popular item $data = $api->items->popular(); // Get detailed data for an item $data = $api->items->data('8403b27-7c9f125-ef5487b-552aeab'); // Search for an item $data = $api->items->search('item name'); var_dump($data); /** CHALLENGES **/ // Get season 3 challenges $data = $api->challenges->get("season 3"); // Get current season challenges $data = $api->challenges->get(); var_dump($data); /** USERS **/ // First find a user: $data = $api->user->id('ninja'); // After that we can query for user stats $stats = $api->user->stats(); // If you want to query for old v1 stats: $stats = $api->user->v1Stats(); /** WEAPONS **/ // List all current weapons: $data = $api->weapons->get();
免责声明
所使用的部分材料是Epic Games, Inc.的商标和/或受版权保护的作品。Epic保留所有权利。此材料不是官方的,也未获得Epic的认可。