ge-tracker / osrs-api
Interacts with the official OSRS API
Installs: 2 532
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
Requires
- php: ^8.0
- ext-json: *
- guzzlehttp/guzzle: ^7.0.1
- illuminate/http: ^8.0|^9.0|^10.0
- illuminate/support: ^8.0|^9.0|^10.0
- spatie/data-transfer-object: ^3.0
- spatie/laravel-queueable-action: ^2.5
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.6
- gtjamesa/php-standards: ^2.0
- orchestra/testbench: ^6.0|^7.0|^8.0
- phpunit/phpunit: ^9.0
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.