A PHP library for the Game Jolt API.

v1.0.1 2019-01-18 19:34 UTC

This package is auto-updated.

Last update: 2020-06-19 00:56:06 UTC



This library provides full (except batching) coverage of Game Jolt's API (Trophies, Scores, Sessions, etc...) At the moment this library is written and tested for v1.2 of Game Jolt's API.


$ composer require "harrk/gamejolt-api"


Create an instance of GamejoltApi and provide a GamejoltConfig to begin making API calls to Game Jolt.

$api = new GamejoltApi(new GamejoltConfig(


Below are examples of how you would interact with each endpoint. Bare in mind that these are only examples, and may not use all parameter options.

Refer to the Game Jolt API Documentation or the source code for more options.

Data Store

The Data Store API can be used to store/retrieve data in the cloud.

// Fetch the value for my-key

// Set the value for my-key to my-value
$api->dataStore()->set('my-key', 'my-value');

// Update player-logins by 1
$api->dataStore()->update('player-logins', DataStore::OPERATION_ADD, 1);

// Remove my-key

// Fetch all keys


The Friends API can only be used to find the friend IDs of the user currently.

// Fetch all friend ids for the user
$api->friends()->fetch('username', 'user-token');


//Fetch scores

//Fetch all score tables

//Add a gamejolt user's score to the table
$api->scores()->addUserScore('username', 'user_token', '100 Jumps', 100);

//Add a guest's score to the table
$api->scores()->addGuestScore('Mr Guest', '50 jumps', 50);

//Get score rank


//Open a session for the given user
$api->sessions()->open('username', 'user_token');

//Let GJ know the user session is still active
$api->sessions()->ping('username', 'user_token', Sessions::STATUS_ACTIVE);

//Check if the session is still open for user
$api->sessions()->check('username', 'user_token');

//Close the session for user
$api->sessions()->close('username', 'user_token');


//Get GJ's server time


//Get all trophies
$api->trophies()->fetch('username', 'user_token');

//User has achieved a trophy with ID 1
$api->trophies()->addAchieved('username', 'user_token', 1);

//User unachieved trophy with ID 1
$api->trophies()->removeAchieved('username', 'user_token', 1);


//Fetch data on user
$api->users()->fetch('username', 'user_token');

//Verify if the user's credentials are correct
$api->users()->auth('username', 'user_token');


Two commands have been provided to simplify the running of tests.

Run Unit Tests

$ composer test

Run Static Code Analysis

$ composer analyse


  • Allow POST method on endpoints
  • Increase coverage of Unit Tests


MIT License