Guildwars 2 API client
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

GW2 Api Client

This project can be used to request GW2 api through PHP.

It is currently used by

The classes I wrote are very robust : retries when the api is not well responding, it manages long list of ids while manking several request and returning to you the whole response, and so on.

Init objects

// init Environment
$env = new Arnapou\GW2Api\Environment();

// init cache (here it is a Mongo cache, but it can be a file cache or whatever you want)
$mongo   = MongoDB\Client('mongodb://localhost:27017', [], ['typeMap' => ['root' => 'array', 'document' => 'array']]);
$mongoDB = $mongo->selectDatabase("my_db");
$cache   = new Arnapou\GW2Api\Cache\MongoCache($mongoDB);

// init storage (optional, but recommended, here, we used the same mongo database as before)
$storage = new Arnapou\GW2Api\Storage\MongoStorage($mongoDB);

// set lang (en, fr, de, es)

// set access token

Browse account through objects (use storage if set)

$account = new Arnapou\GW2Api\Model\Account($env);


$account->getCharacter('My Character Name')->getEquipment('Helm')->getName();

Use api to retrieve raw api data (ignore storage, only cache is used)



Fully custom use

// get api raw data
$data = $env->getClientVersion2()->apiPets([28]);

// instanciate object with data and use it as you wish
$pet = new Arnapou\GW2Api\Model\Pet($env, $data[0]);


  • PHP 7+
  • PECL extension mongodb version >=1.1.0 and <2.0.0