Skip to content

ge-tracker/osrs-api

Repository files navigation

OSRS API

This package is a Laravel/PHP wrapper for the OSRS API, to easily interact with the Grand Exchange and Hiscore APIs.

Installation

You can install the package via composer:

composer require ge-tracker/osrs-api

If you wish to publish the package's configuration, you can run the following command:

php artisan vendor:publish --provider="GeTracker\OsrsApi\OsrsApiServiceProvider"

Usage

We recommend using this package via dependency injection in your methods, as this is a cleaner interface than a facade.

Accessing the Grand Exchange API

public function execute(OsrsApi $osrsApi)
{
    $item = $osrsApi->ge()->itemDetail(13576);
    echo $item->id . ': ' . $item->name;
}

Fetching hiscores

All requests to the hiscores are cached for 60 seconds by default.

public function execute(OsrsApi $osrsApi)
{
    $hiscores = $osrsApi->hiscores()->fetch('Lynx Titan');
    
    echo 'Attack: ' . $hiscores->stats->attack->level;
}

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.