2017 © Pedro PelĆ”ez
 

library wargaming-papi

Provides a useful interface to connect and use Wargaming Public API

image

artur-stepien/wargaming-papi

Provides a useful interface to connect and use Wargaming Public API

  • Monday, February 26, 2018
  • by arturstepien
  • Repository
  • 5 Watchers
  • 3 Stars
  • 11 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 120 % Grown

The README.md

Wargaming Public API

Basic PHP library handling Wargaming Public API. Uses namespace to get data sources so it is compatible with all sources (WoT, Blitz, WGN, WoWp and also WoWs) and all servers (EU,NA,ASIA,RU,KR). All it needs is application_id that can be obtained here https://eu.wargaming.net/developers/applications/ (for EU)., (*1)

Requirements

  • PHP 7.0+
  • CURL

Sample usage

``` php <?php, (*2)

use Wargaming\Language\EN as EnglishLanguage; use Wargaming\Server\EU as EuropeanServer;, (*3)

require_once DIR.'/vendor/autoload.php';, (*4)

// API Instance where YOUR_APPLICATION_ID is your application_id registered for the server you use. $lang = new EnglishLanguage(); $server = new EuropeanServer('YOUR_APPLICATION_ID'); $api = new Wargaming\API($lang, $server);, (*5)

// Test how it works try { $data = $api->get('wgn/clans/list', ['search'=>'PSQD','fields'=>'name,tag,clan_id']);, (*6)

// Display info about WoT Clan PSQD
var_dump($data);

} catch (Exception $e) {, (*7)

die($e->getMessage());

}, (*8)


## Sample ETag usage ``` php <?php use Wargaming\Language\EN as EnglishLanguage; use Wargaming\Server\EU as EuropeanServer; require_once __DIR__.'/vendor/autoload.php'; // API Instance where YOUR_APPLICATION_ID is your application_id registered for the server you use. $lang = new EnglishLanguage(); $server = new EuropeanServer('YOUR_APPLICATION_ID'); $api = new Wargaming\API($lang, $server); // Test how it works try { // As a 4th param provide ETag. If tag of a clan S3AL wasn't changed method will return true. If it changed new data will be returned. $info = $api->get('wgn/clans/info', ['clan_id'=>'500034335','fields'=>'tag'], false, '813ac115749538da9b3b61fd4069fd44'); var_dump($info);die; } catch( Exception $e) { exit('Error: '.$e->getMessage()); }

How to get ETag from API request

``` php <?php, (*9)

use Wargaming\Language\EN as EnglishLanguage; use Wargaming\Server\EU as EuropeanServer;, (*10)

require_once DIR.'/vendor/autoload.php';, (*11)

// API Instance where YOUR_APPLICATION_ID is your application_id registered for the server you use. $lang = new EnglishLanguage(); $server = new EuropeanServer('YOUR_APPLICATION_ID'); $api = new Wargaming\API($lang, $server);, (*12)

// Test how it works try { // Set 5th param to boolean TRUE. That way method will return array with following format: ['headers'=>[],'data'=>StdClass] $info = $api->get('wgn/clans/info', ['clan_id'=>'500034335','fields'=>'tag'], false, null, true);, (*13)

// Get response headers. Remember to store ETag without quotes cause $api->get() method add those when ETag is provided.
var_dump($info['headers']['ETag']);die;

} catch( Exception $e) {, (*14)

exit('Error: '.$e->getMessage());

} ```, (*15)

News

1.4.1 - 2022-05-09

  • Allow chaining in set methods.
  • Simplified some of the conditions.
  • Fixed few typos in documentation.

1.4.0 - 2021-06-08

  • Prepared for use in dependency injection.
  • Added a public function setSSLVerification(bool $state) method to change SSL connection verification status (CURLOPT_SSL_VERIFYPEER).
  • Changed api instance declaration to allow multiple servers
  • Added server instance declaration to allow injected application id (api key)

1.3.1 - 2018-02-26

Creating composer package., (*16)

1.3 - 2017-10-09

Moving to PHP7, changing code to PSR., (*17)

1.2 - 2016-02-06

From now if CURL return an error class will throw exception with that error message. Also added support for ETag (Documentation) and HTTP headers., (*18)

1.1 - 2015-08-20

Moved to CURL for requests. Speed boost shoold be from 50% - 150% cause of reusing connection. Checked on my WN8 calculation class. Regular calculation takes 0.32s, (*19)

1.04 - 2015-08-19

Fixed few error messages., (*20)

1.03 - 2015-08-17

Fixed error handling for associative arrays, added new error messages., (*21)

1.02 - 2015-08-17

Added new parameter to API::get() called $assoc. If this parameter is set to true, function will return associative array instead of object/array of objects., (*22)

The Versions

26/02 2018

dev-master-dev

dev-master-dev https://github.com/artur-stepien/wargaming-papi

Provides a useful interface to connect and use Wargaming Public API

  Sources   Download

GPL-3.0-or-later

The Requires

  • php >=7.0.0

 

wot wargaming world of tanks wg

26/02 2018

dev-master

9999999-dev https://github.com/artur-stepien/wargaming-papi

Provides a useful interface to connect and use Wargaming Public API

  Sources   Download

GPL-3.0-or-later

The Requires

  • php >=7.0.0

 

wot wargaming world of tanks wg

26/02 2018

1.3.3

1.3.3.0 https://github.com/artur-stepien/wargaming-papi

Provides a useful interface to connect and use Wargaming Public API

  Sources   Download

GPL-3.0-or-later

The Requires

  • php >=7.0.0

 

wot wargaming world of tanks wg

26/02 2018

1.3.2

1.3.2.0 https://github.com/artur-stepien/wargaming-papi

Provides a useful interface to connect and use Wargaming Public API

  Sources   Download

GPL-3.0-or-later

The Requires

  • php >=7.0.0

 

wot wargaming world of tanks wg

26/02 2018

1.3.1

1.3.1.0 https://github.com/artur-stepien/wargaming-papi

Provides a useful interface to connect and use Wargaming Public API

  Sources   Download

GNU 3.0

The Requires

  • php >=7.0.0

 

wot wargaming world of tanks wg