PHPackages                             nexgenspin/coordinator - 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. nexgenspin/coordinator

ActiveLibrary[API Development](/categories/api)

nexgenspin/coordinator
======================

PHP client for the NexGenSpin Coordinator API with Ed25519 request signing

v0.2.0(3mo ago)00MITPHPPHP ^7.4 || ^8.0

Since Apr 2Pushed 3mo agoCompare

[ Source](https://github.com/nexgenspin/coordinator-php)[ Packagist](https://packagist.org/packages/nexgenspin/coordinator)[ Docs](https://github.com/nexgenspin/coordinator-php)[ RSS](/packages/nexgenspin-coordinator/feed)WikiDiscussions main Synced 4w ago

READMEChangelogDependenciesVersions (3)Used By (0)

NexGenSpin Coordinator PHP Client
=================================

[](#nexgenspin-coordinator-php-client)

Minimal PHP client for the NexGenSpin Coordinator API with Ed25519 request signing via `ext-sodium`.

Overview
--------

[](#overview)

This package demonstrates how to:

- Sign Coordinator requests as `timestamp + exact JSON body`
- Send the required authentication headers
- Query games, currencies, and languages
- Create demo and real-money sessions

The client itself accepts a single private key format:

- PKCS#8 DER encoded private key represented as hex

For convenience, the example script can read a PEM file and convert it into PKCS#8 DER hex before constructing the client.

Requirements
------------

[](#requirements)

- PHP 7.4+
- `ext-sodium`

Compatibility has been verified with a live request in Docker using `php:7.4-cli`.

Repository Layout
-----------------

[](#repository-layout)

- `src/NexGenSpinCoordinatorClient.php` — Coordinator client
- `src/KeyLoader.php` — PEM to PKCS#8 DER hex helper
- `examples/smoke_test.php` — runnable staging smoke test
- `examples/compose.yaml` — local Docker/OrbStack smoke test

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

[](#installation)

Install the package with Composer:

```
composer require nexgenspin/coordinator
```

Then autoload it through Composer:

```
require __DIR__ . '/vendor/autoload.php';
```

Quick Start
-----------

[](#quick-start)

The bundled example uses:

- Staging environment
- A hardcoded operator caller ID in `examples/smoke_test.php`
- A local PEM file at `./operator.pem`

Run it with:

```
docker compose -f examples/compose.yaml run --rm php
```

Before running the example, place your own private key at `./operator.pem` or update the path in `examples/smoke_test.php`.

Client Construction
-------------------

[](#client-construction)

### From PKCS#8 DER hex

[](#from-pkcs8-der-hex)

```
require __DIR__ . '/vendor/autoload.php';

use NexGenSpin\Coordinator\NexGenSpinCoordinatorClient;

$client = NexGenSpinCoordinatorClient::staging(
    '019d4f70-2dfa-781a-9de6-39503e63c0f4',
    '302e020100300506032b65700422042033a9b1b71e0deb2e8354098106c9d349bac6f46ae486303b4cf974a94fc7a2fb'
);
```

### From PEM file

[](#from-pem-file)

```
require __DIR__ . '/vendor/autoload.php';

use NexGenSpin\Coordinator\KeyLoader;
use NexGenSpin\Coordinator\NexGenSpinCoordinatorClient;

$pkcs8DerHex = KeyLoader::pkcs8DerHexFromPemFile(__DIR__ . '/operator.pem');

$client = NexGenSpinCoordinatorClient::staging(
    '019d4f70-2dfa-781a-9de6-39503e63c0f4',
    $pkcs8DerHex
);
```

Example
-------

[](#example)

```
require __DIR__ . '/vendor/autoload.php';

use NexGenSpin\Coordinator\KeyLoader;
use NexGenSpin\Coordinator\NexGenSpinCoordinatorClient;

$pemPath = __DIR__ . '/operator.pem';
$pkcs8DerHex = KeyLoader::pkcs8DerHexFromPemFile($pemPath);

$client = NexGenSpinCoordinatorClient::staging(
    '019d4f70-2dfa-781a-9de6-39503e63c0f4',
    $pkcs8DerHex
);

$games = $client->games();
print_r($games['response']['json']);
```

Available Methods
-----------------

[](#available-methods)

### `games()`

[](#games)

Fetches the list of games available to the operator.

```
$games = $client->games();
print_r($games['response']['json']);
```

### `currencies()`

[](#currencies)

Fetches the list of supported currencies.

```
$currencies = $client->currencies();
print_r($currencies['response']['json']);
```

### `languages()`

[](#languages)

Fetches the list of supported languages.

```
$languages = $client->languages();
print_r($languages['response']['json']);
```

### `createSession(array $input)`

[](#createsessionarray-input)

Creates a game session.

#### Demo session

[](#demo-session)

For a demo session, omit the operator session and customer identifiers.

```
$demoSession = $client->createSession([
    // Game identifier from the games query
    'game' => ['id' => '019d2822-20ed-7212-95a9-def642d50ddf'],

    // Currency for all transactions within this session (immutable)
    'currency' => ['code' => 'USD'],

    // Preferred language (BCP 47)
    'languageTag' => 'en',

    // IP address of the customer — supports both IPv4 and IPv6 formats
    'ipAddress' => '203.0.113.42',
]);

print_r($demoSession['response']['json']);
```

#### Real-money session

[](#real-money-session)

```
$session = $client->createSession([
    // Session ID on the Operator's platform
    'id' => 'SESSION_ID_ON_OPERATOR_SIDE',

    // Game identifier from the games query
    'game' => ['id' => '019d2822-20ed-7212-95a9-def642d50ddf'],

    // Customer on the Operator's platform
    'customer' => [
        // Customer ID on the Operator's platform
        'id' => 'CUSTOMER_ID_ON_OPERATOR_SIDE',

        // Name is optional — displayed in the game interface, auto-generated if omitted
        'name' => 'John',

        // ISO 3166-1 alpha-2 country code
        'countryCode' => 'US',
    ],

    // Currency for all transactions within this session (immutable)
    'currency' => ['code' => 'USD'],

    // Preferred language (BCP 47)
    'languageTag' => 'en',

    // IP address of the customer — supports both IPv4 and IPv6 formats
    'ipAddress' => '203.0.113.42',
]);

print_r($session['response']['json']);
```

Response Shape
--------------

[](#response-shape)

Each client method returns an array with:

- `request.timestamp`
- `request.body`
- `request.signature`
- `response.headers`
- `response.body_raw`
- `response.json`

The response structure is intentionally verbose to support debugging and integration testing.

Integration Notes
-----------------

[](#integration-notes)

- Coordinator signatures are computed as `timestamp + exact JSON body`
- There is no delimiter between the timestamp and the body
- The body you sign must be byte-for-byte identical to the body you send
- GraphQL requests with no variables must send `{}` rather than `[]`

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance82

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

90d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0464d738c3c4437d41b4e8a9771f26d154cf28cbb0626f246c6b879c7efe2b9e?d=identicon)[pasiba](/maintainers/pasiba)

---

Top Contributors

[![pasiba](https://avatars.githubusercontent.com/u/8863448?v=4)](https://github.com/pasiba "pasiba (2 commits)")

### Embed Badge

![Health badge](/badges/nexgenspin-coordinator/health.svg)

```
[![Health](https://phpackages.com/badges/nexgenspin-coordinator/health.svg)](https://phpackages.com/packages/nexgenspin-coordinator)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M19](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k12](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

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