PHP code example of samiaraboglu / pubg-php-api

1. Go to this page and download the library: Download samiaraboglu/pubg-php-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

samiaraboglu / pubg-php-api example snippets


$config = new Pubg\Config();
$config->setApiKey('{API_KEY}');
$config->setPlatform('{PLATFORM}');

$api = new Pubg\Api($config);

$playerService = new Pubg\Player($api);

// by player name
$player = $playerService->get('{PLAYER_NAME}');

// by account id
$player = $playerService->get('{ACCOUNT_ID}');

// by players names
$players = $playerService->getAll(['{PLAYER_NAME_1}', '{PLAYER_NAME_2}']);

// by accounts ids
$players = $playerService->getAll(['{ACCOUNT_ID_1}', '{ACCOUNT_ID_2}']);

$seasonService = new Pubg\Season($api);

$seasons = $seasonService->getAll();

$season = $seasonService->get('{ACCOUNT_ID}', '{SEASON_ID}');

$lifetimeService = new Pubg\Lifetime($api);

$lifetime = $lifetimeService->get('{ACCOUNT_ID}');

$matchService = new Pubg\Match($api);

$match = $matchService->get('{MATCH_ID}');

$leaderboardService = new Pubg\Leaderboard($api);

$leaderboards = $leaderboardService->get('{GAME_MODE}', {PAGE_NUMBER});

$tournamentService = new Pubg\Tournament($api);

$tournaments = $tournamentService->getAll();

$tournament = $tournamentService->get('{TOURNAMENT_ID}');

$sampleService = new Pubg\Sample($api);

$samples = $sampleService->get();

// date filter
$samples = $sampleService->get('2019-03-29T00:00:00Z');

$ composer