ge-tracker/osrs-api

Interacts with the official OSRS API

v2.0.2 2023-03-06 12:05 UTC

This package is auto-updated.

Last update: 2024-04-06 14:45:23 UTC


README

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 james@ge-tracker.com 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.