vestervang/rs-api

An api to create a interface to all Runescape api's

v1.0.5 2018-04-12 17:20 UTC

This package is auto-updated.

Last update: 2024-09-29 04:37:14 UTC


README

Build Status Latest Stable Version Latest Unstable Version Total Downloads License

Core code is from Burthorpe's runescape-api

Installation

Dependencies

Installation

composer require vestervang/rs-api

Usage

Hiscore

require __DIR__.'/vendor/autoload.php';

use vestervang\rsApi\RS3\Hiscore;

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

If you want to loop through the list of stats you can do it like this:

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>';
}

Or if you want to use a foreach:

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>';

}

GE

The only way to get a item price at the moment is by finding the id and using that.

require __DIR__.'/vendor/autoload.php';

use vestervang\rsApi\RS3\GE;

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

I calculate the percent difference myself to get a more accurate number instead of the +0.0% og -0.0% the api returns.

Bestiary

In the bestiary api there is a option to save the result of an api call to a repo (The result will be saved to the repo as a Beast object).

This can be turned off on a per call basis. Just send false as a second parameter and it won't save the data in the repo.

Id

require __DIR__.'/vendor/autoload.php';

$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);

This will return the json for a monster with all details.

Name

require __DIR__.'/vendor/autoload.php';

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

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

This will return the json for a list of beasts with names and ids.

Level

require __DIR__.'/vendor/autoload.php';

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

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

This will return the json for a list of beasts with names and ids.

Letter

require __DIR__.'/vendor/autoload.php';

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

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

This will return the json for a list of beasts with names and ids.

Area

This function is case-sensetive 'The Abyss' and 'The abyss' will not return the same results.

require __DIR__.'/vendor/autoload.php';

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

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

This will return the json for a list of beasts with names and ids.