rkmaier / pubgapi
A PUBG Developer API Wrapper for PHP and Laravel
0.2.6
2018-06-23 12:41 UTC
Requires
- php: >=7.0.0
- ixudra/curl: 6.*
- pragmarx/ia-collection: 5.6.*
README
Installation
composer require rkmaier/pubgapi
Laravel 5.5+ Integration
Laravel Pacakage discovery should take care of it
Laravel 5.* Integration
Add the service provider to your config/app.php
file:
'providers' => array( //... Rkmaier\Pubgapi\PubgApiService::class, ),
Add the facade to your config/app.php
file:
'aliases' => array( //... 'PubgApi' => Rkmaier\Pubgapi\Facades\PubgApi::class, ),
Publish config file
php artisan vendor:publish
Edit config file
return [ 'api_url'=>'https://api.playbattlegrounds.com/shards/', 'region' => 'pc-eu', 'access_token' =>'', ];
Laravel
Get API Status
PubgApi::status()
Set Region
PubgApi::region('pc-na')
Filter by Player Names
PubgApi::region('pc-na')->players('shroud')->get();
Get Player Info
PubgApi::region('pc-eu')->player('<PLAYER_ID>')->get();
PubgApi::region('pc-eu')->player('<PLAYER_NAME')->get();
Get Seasons
PubgApi::region('pc-eu')->seasons()->get();
Get Player Stats
PubgApi::region('pc-eu')->playerStats('<PLAYER_NAME')->get;
PubgApi::region('pc-eu')->playerStats('<PLAYER_NAME')->get(); // Current Season by default
PubgApi::region('pc-eu')->playerStats('<PLAYER_NAME','SEASON_ID')->get;
PubgApi::region('pc-eu')->playerStats('<PLAYER_NAME')->stat('duo-fpp');
PubgApi::region('pc-eu')->playerStats('<PLAYER_NAME','<SEASON_ID>')->stat('duo-fpp');
Get Player Match IDs
PubgApi::region('pc-eu')->player('<PLAYER_NAME')->matches();
Filter by Match ID
PubgApi::region('pc-eu')->match('<MATCH_ID>')->get();
Pagination
PubgApi::region('pc-eu')->players('<PLAYER_ID1>','<PLAYER_ID2>','<PLAYER_ID3>')->limit(1)->offset(2)->get();
PHP without Laravel
require_once 'vendor/autoload.php'; $data['access_token'] = '<YOUR PUBG DEV ACCESS TOKEN>'; $pubgAPi = new \Rkmaier\Pubgapi\PubgApiService($data); $pubgAPi->region('pc-eu')->players('rkmaier,molnarz,Istvan92,zuuup,Aigialeusz')->get());
License
Pubgapi is licensed under the MIT License.
Copyright 2018 Erik Maier