PHPackages                             harrk/gamejolt-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. harrk/gamejolt-api

ActiveLibrary[API Development](/categories/api)

harrk/gamejolt-api
==================

A PHP library for the Game Jolt API.

2.1.0(2y ago)42.6k1MITPHPPHP ^8.1|8.2|8.3CI failing

Since Jan 18Pushed 2y ago3 watchersCompare

[ Source](https://github.com/Harrk/gamejolt-api)[ Packagist](https://packagist.org/packages/harrk/gamejolt-api)[ Docs](https://github.com/Harrk/gamejolt-api)[ RSS](/packages/harrk-gamejolt-api/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (2)Dependencies (3)Versions (12)Used By (0)

Gamejolt API PHP Library
========================

[](#gamejolt-api-php-library)

[![CircleCI](https://camo.githubusercontent.com/50c767bd5cf7559b1a3eab45a136549a8d24e592ba957a957ad8b1ea7f76e6b1/68747470733a2f2f636972636c6563692e636f6d2f67682f486172726b2f67616d656a6f6c742d6170692f747265652f6d61737465722e7376673f7374796c653d737667)](https://circleci.com/gh/Harrk/gamejolt-api/tree/master)

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.

Installation
------------

[](#installation)

```
$ composer require "harrk/gamejolt-api"
```

Usage
-----

[](#usage)

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

```
$gameId = 0; // Your game's ID
$gamePrivaykey = "Your game's private key";

$api = new GamejoltApi(new GamejoltConfig(
    $gameId,
    $gamePrivaykey
));
```

Endpoints
---------

[](#endpoints)

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](https://gamejolt.com/game-api/doc) or the source code for more options.

### Data Store

[](#data-store)

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

```
// Fetch the value for my-key
$api->dataStore()->fetch('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
$api->dataStore()->remove('my-key');

// Fetch all keys
$api->dataStore()->getKeys();
```

### Friends

[](#friends)

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');
```

### Scores

[](#scores)

```
//Fetch scores
$api->scores()->fetch();

//Fetch all score tables
$api->scores()->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
$api->scores()->getRank(60);
```

### Sessions

[](#sessions)

```
//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');
```

### Time

[](#time)

```
//Get GJ's server time
$api->time()->fetch();
```

### Trophies

[](#trophies)

```
//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);
```

### Users

[](#users)

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

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

### Catching Exceptions

[](#catching-exceptions)

Here is a example on how to catch exceptions:

```
try {
    $auth = $api->users()->auth('username', 'user_token');
} catch (TimeOutException $e) {
    return redirect()->route('home')->with('error', $e->getMessage());
}
```

Testing
-------

[](#testing)

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

**Run Unit Tests**

```
$ composer test
```

**Run Static Code Analysis**

```
$ composer analyse
```

Todo
----

[](#todo)

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

License
-------

[](#license)

MIT License

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 55.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~177 days

Recently: every ~133 days

Total

11

Last Release

941d ago

Major Versions

v1.2.4 → v2.0.02023-02-19

PHP version history (5 changes)v1.0.0PHP ^7.0

v1.1.0PHP ^7.1|^8.0

v1.2.3PHP ^7.2|^8.0

v2.0.0PHP ^8.1|8.2

2.1.0PHP ^8.1|8.2|8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/64437724a6c23ab6dd2596863e9bde27f24bd6c6b7a52f182010b6cd7334474c?d=identicon)[Harrk](/maintainers/Harrk)

---

Top Contributors

[![Harrk](https://avatars.githubusercontent.com/u/2372590?v=4)](https://github.com/Harrk "Harrk (10 commits)")[![dsbilling](https://avatars.githubusercontent.com/u/9788214?v=4)](https://github.com/dsbilling "dsbilling (8 commits)")

---

Tags

gamegamedevgamejoltgamejolt-apiphpphp-libraryphpcomposerapigamejoltGamejoltGamedev

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/harrk-gamejolt-api/health.svg)

```
[![Health](https://phpackages.com/badges/harrk-gamejolt-api/health.svg)](https://phpackages.com/packages/harrk-gamejolt-api)
```

###  Alternatives

[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.7k371.6k6](/packages/theodo-group-llphant)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3661.2M46](/packages/tencentcloud-tencentcloud-sdk-php)[resend/resend-php

Resend PHP library.

596.2M35](/packages/resend-resend-php)[checkout/checkout-sdk-php

Checkout.com SDK for PHP

563.5M10](/packages/checkout-checkout-sdk-php)[mozex/anthropic-laravel

Laravel integration for the Anthropic API: facade, config publishing, install command, testing fakes, messages, streaming, tool use, thinking, and batches.

72287.1k1](/packages/mozex-anthropic-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
