hardmode2015/pubgapi

A PUBG Developer API Wrapper for PHP and Laravel

dev-master 2020-02-13 08:41 UTC

This package is auto-updated.

Last update: 2024-04-13 17:46:44 UTC


README

Total Downloads License

Installation

composer require hardmode2015/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