1. Go to this page and download the library: Download fortnite-api/php-wrapper 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/ */
fortnite-api / php-wrapper example snippets
use FortniteApi\FortniteApi;
$api = new FortniteApi();
// accesses the cosmetics endpoint (https://fortnite-api.com/cosmetics)
$api->cosmetics->...
// accesses the news endpoint (https://fortnite-api.com/news)
$api->news->...
// accesses the shop endpoint (https://fortnite-api.com/shop)
$api->shop->...
// accesses the creatorcode endpoint (https://fortnite-api.com/creatorcode)
$api->creatorCode->...
// returns the base uri of the api (https://fortnite-api.com)
FortniteApi::getBaseUri();
// returns an array of all supported languages
FortniteApi::getSupportedLanguages();
$result = $api->cosmetics->getAll();
if ($result === null)
{
$lastError = FortniteApiError::getLastError();
// this just shows which members you can access
$members = [
$lastError->statusCode,
$lastError->reasonPhrase,
$lastError->body,
$lastError->message
];
}
// Returns the error set by the last request or false if none is set.
FortniteApiError::getLastError();
// Determines whether an error occured within the last called function.
FortniteApiError::hasLastError();
// returns "instantly"
$task = $api->cosmetics->getAllAsync();
// retreives the result (the one you get from non-async versions)
$result = $task->await();
// key value pairs also support arrays as value if the api allows this
$query = [
"rarity" => "uncommon",
"hasIcon" => true
];
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.