PHP code example of villermen / runescape-lookup-commons

1. Go to this page and download the library: Download villermen/runescape-lookup-commons 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/ */

    

villermen / runescape-lookup-commons example snippets


use Villermen\RuneScape\HighScore\HighScoreSkill;
use Villermen\RuneScape\HighScore\OsrsSkill;
use Villermen\RuneScape\HighScore\Rs3HighScore;
use Villermen\RuneScape\HighScore\Rs3Skill;
use Villermen\RuneScape\Player;
use Villermen\RuneScape\Service\PlayerDataFetcher;

$fetcher = new PlayerDataFetcher(); // You can optionally provide your own HTTP client.
$player = new Player('playername');

$rs3HighScore = $fetcher->fetchIndexLite($player, oldSchool: false);
$mining = $rs3HighScore->getSkill(Rs3Skill::MINING);
$mining->level; // 110
$mining->getVirtualLevel(); // 123
$mining->getXpToNextLevel(); // 1231231
$rs3HighScore->getSkill(Rs3Skill::NECROMANCY)->xp // null
$rs3HighScore->getSkill(Rs3Skill::TOTAL)->rank; // 1200000
$rs3HighScore->getCombatLevel( "PlayerName"
$runeMetrics->highScore; // Rs3HighScore
$runeMetrics->activityFeed->items[0]->title; // "Quest complete: Evil Dave's big day out"

$adventurersLog = $fetcher->fetchAdventurersLog($player);
$adventurersLog->displayName; // "PlayerName"
$adventurersLog->activityFeed->items[0]->description; // "I somehow switched bodies with Evil Dave and survived enough chores and shouting from Doris to find a way to swap back!"