2017 © Pedro Peláez
 

library phpubg

PHP Wrapper for PUBG tracker api

image

mcmainiac/phpubg

PHP Wrapper for PUBG tracker api

  • Wednesday, March 21, 2018
  • by MCMainiac
  • Repository
  • 2 Watchers
  • 6 Stars
  • 103 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 5 Versions
  • 4 % Grown

The README.md

PHPUBG

Test Status, (*1)

PHP wrapper for the PUBG Tracker API., (*2)

Installation

PHPUBG is available on packagist, so you can easily require it via composer:, (*3)

composer require mcmainiac/phpubg

To use this as a standalone library (without composer), download the repository and extract it somewhere (preferably in your projects libraries folder) and set up an autoloader to load all files dynamically. The root namespace of this library is \PHPUBG., (*4)

Usage

To get your own api key, please visit pubgtracker.com/site-api., (*5)

Assuming you are at the root of your project (the vendor folder is within your current folder):, (*6)

<?php

require __DIR__  . "/vendor/autoload.php";

use PHPUBG\Region;
use PHPUBG\PubgBuilder;

$statsEurope = PubgBuilder::setApiKey("your-api-key")
    ->getPlayer("MCMainiac")
    ->getStats(
        Region::get(Region::EUROPE)
    );

var_dump($statsEurope);

This should dump all stats available for the player "MCMainiac" in the region "Europe"., (*7)

You can also use the Steam Id (a 64 bit number) instead of the username. PHPUBG will automatically resolve the username and get the stats:, (*8)

<?php
$builder = PubgBuilder::setApiKey("your-api-key");

$playerByName = $builder->getPlayer("MCMainiac");
$playerBySteamId = $builder->getPlayer(76561198128415640); // steam id for "MCMainiac"

// At this point $playerByName and $playerBySteamId are equivalent entities.

$playerByName->getNickname() == $playerBySteamID->getNickname(); // will return true

If you want to apply another filter, just pass it to the getStats method:, (*9)

$player->getStats($region, $season, $mode);

whereas:, (*10)

  • $region is an instance from the \PHPUBG\Region class or null
  • $season is an instance from the \PHPUBG\Season class or null
  • $mode is an instance from the \PHPUBG\matches\MatchMode class or null

If any variable of the above is null, then any value for this filter is accepted., (*11)

Example: You want to get all stats for the region "Europe" and the match mode "Solo":, (*12)

$region = Region::get(Region::EUROPE);
$mode = MatchMode::get(MatchMode::SOLO);

$europeSoloStats = $player->getStats($region, null, $mode);

Development

Feel free to clone the repository, make your changes and open a pull request., (*13)

Please report issues right here on GitHub using the issues system., (*14)

Notes

When requesting stats, please keep the number of requests at ~1/sec., (*15)

Thanks to pubgtracker.com for their public api., (*16)

Thanks to all contributors!, (*17)

Support on Beerpay

Hey dude! Help me out for a couple of :beers:!, (*18)

Beerpay Beerpay, (*19)

The Versions

21/03 2018

dev-master

9999999-dev https://github.com/MCMainiac/PHPUBG

PHP Wrapper for PUBG tracker api

  Sources   Download

MIT

The Requires

  • php >=7.1.5

 

The Development Requires

02/11 2017

v1.0.3

1.0.3.0 https://github.com/MCMainiac/PHPUBG

PHP Wrapper for PUBG tracker api

  Sources   Download

MIT

The Requires

  • php >=7.1.5

 

The Development Requires

01/11 2017

v1.0.2

1.0.2.0 https://github.com/MCMainiac/PHPUBG

PHP Wrapper for PUBG tracker api

  Sources   Download

MIT

The Requires

  • php >=7.1.5

 

The Development Requires

05/08 2017

v1.0.1

1.0.1.0 https://github.com/MCMainiac/PHPUBG

PHP Wrapper for PUBG tracker api

  Sources   Download

MIT

The Requires

  • php >=7.1.5

 

The Development Requires

05/08 2017

v1.0.0

1.0.0.0

PHP Wrapper for PUBG tracker api

  Sources   Download

MIT

The Development Requires