PHP code example of uproargg / destiny-php
1. Go to this page and download the library: Download uproargg/destiny-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/ */
uproargg / destiny-php example snippets
// Include the autoloader
client
$destiny = new \Destiny\Destiny('YOUR_API_KEY');
// Find a player
$player = $destiny->fetchXboxPlayer('aFreshMelon');
// Get the first character
$firstCharacter = $player->characters->first();
// Output the characters level
echo $firstCharacter->characterLevel;
$xboxPlayer = $destiny->fetchXboxPlayer('Player Name'); // Destiny\Game\Player
$psnPlayer = $destiny->fetchPsnPlayer('Player_Name'); // Destiny\Game\Player
$anyPlayer = $destiny->fetchPlayer('PlayerName', 2); // Destiny\Game\Player
$playerExists = $destiny->playerExists('PlayerName', 1); // boolean
echo $player->iconPath; // string
echo $player->membershipType; // integer
echo $player->membershipId; // integer
echo $player->displayName; //string
$grimoireData = $player->fetchGrimoireData(); // array
$characters = $player->characters; // Destiny\Support\Collections\CharacterCollection
$lastPlayedCharacter = $characters->first(); // Destiny\Game\Character
$lastPlayedWarlock = $characters->firstWarlock(); // Destiny\Game\Character
$allWarlocks = $characters->getWarlocks(); // array
$allCharacters = $characters->all(); // array
$lastCharacters = $characters->last(); // Destiny\Game\Character
$allCharacters = $characters->get(2); // Destiny\Game\Character
$numberOfCharacters = $characters->count(); // integer
echo $character->characterLevel; // integer
echo $character->classHash; // integer
$translator = new \Destiny\Support\Translators\HashTranslator;
echo $translator->translate($character->classHash); // string
echo $translator->reverse($character->classHash); // integer
$progression = $character->progression; // Destiny\Support\Collections\ProgressionCollection
$crucibleProgression = $progression->get('crucible'); // Destiny\Game\Progression
$erisProgression = $progression->get('eris'); // Destiny\Game\Progression
$fwcProgression = $progression->get('fwc'); // Destiny\Game\Progression
$fwcLevel = $fwcProgression->level; // integer
$fwcProgressToNextLevel = $fwcProgression->progressToNextLevel; // integer
$raidData = $character->fetchActivityData(4); // array
$controlData = $character->fetchActivityData(10); // array
$controlDataWithoutExtraInfo = $character->fetchActivityData(10, false); // array
$rumbleData = $character->fetchActivityData(13); // array
$rumbleMatchId = $rumbleData['Response']['data']['activities'][0]['activityDetails']['instanceId']; // string
$pgcr = $character->fetchPostGameCarnageReport($rumbleMatchId); // array
$pgcrWithoutExtraInfo = $character->fetchPostGameCarnageReport($rumbleMatchId, false); // array
$inventory = $character->inventory; // Destiny\Game\Inventory
$primaryWeapon = $inventory->primary(); // Destiny\Game\Item
$subclass = $inventory->subclass(); // Destiny\Game\Item
$classItem = $inventory->classItem(); // Destiny\Game\Item
$legendaryMarks = $inventory->legendaryMarks(); // integer
echo $item->itemName; // string
echo $item->itemTypeName; // string