PHP code example of vestervang / rs-api

1. Go to this page and download the library: Download vestervang/rs-api 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/ */

    

vestervang / rs-api example snippets




use vestervang\rsApi\RS3\Hiscore;

$hiscore = new Hiscore();
$username = 'zezima';
$stats = $hiscore->getStats($username)

for($i = 0; $i < $stats->getCount(); $i++){
	
	$stat = $stats->getStat($i);
	
	echo 'Name: '. $stat->getSkill()->getName(). '<br>';
	echo 'Rank: '. $stat->getRank(). '<br>';
	echo 'Level: '. $stat->getLevel(). '<br>';
	echo 'Xp: '. $stat->getExperience(). '<br>';
	echo '<br><br>';
}

foreach($stats->getStats() as $stat){
	
	echo 'Name: '. $stat->getSkill()->getName(). '<br>';
	echo 'Rank: '. $stat->getRank(). '<br>';
	echo 'Level: '. $stat->getLevel(). '<br>';
	echo 'Xp: '. $stat->getExperience(). '<br>';
	echo '<br><br>';

}



use vestervang\rsApi\RS3\GE;

$api = new GE();
$item = $api->getItemById(4151);



$bestiary = new \vestervang\rsApi\RS3\Bestiary();

//This will save to the repo and returns the json
$beast = $bestiary->getBeastById(49);

//This call only returns the json
$beast = $bestiary->getBeastById(49, false);



$bestiary = new \vestervang\rsApi\RS3\Bestiary();

$beast = $bestiary->getBeastByName('cow');



$bestiary = new \vestervang\rsApi\RS3\Bestiary();

$beast = $bestiary->getBeastsByLevel('150-300');



$bestiary = new \vestervang\rsApi\RS3\Bestiary();

$beast = $bestiary->getBeastsByLetter('y');



$bestiary = new \vestervang\rsApi\RS3\Bestiary();

$beast = $bestiary->getBeastsByArea('The Abyss');