softcreatr/gameq

A maintained PHP game-server status query library based on GameQ by Austinb

4.0.0 2024-09-27 18:19 UTC

This package is auto-updated.

Last update: 2026-08-02 23:39:42 UTC


README

CI Latest Stable Version PHP Version License

GameQ is a PHP library for querying many kinds of multiplayer game and voice servers. A single GameQ instance can query mixed UDP, TCP, TLS, HTTP, and master-list protocols and return a consistent result structure.

This repository is the maintained SoftCreatR Media fork of Austinb/GameQ. Version 5 targets PHP 8.1 and newer, retains the GameQ 4.x public and protected API, and adds current protocol support, stricter parsing, bounded batching, and modern quality checks.

Highlights

  • 170 game, voice-server, and generic protocol identifiers.
  • Concurrent mixed-protocol queries with configurable batch and response limits.
  • Normalized gq_* fields plus protocol-native data, players, teams, and join links.
  • Broad coverage through established families such as Source and GoldSource, GameSpy, Quake, Unreal, Doom 3, Frostbite, RakNet, and dedicated voice-server protocols.
  • Direct UDP, TCP, TLS, and SSL queries alongside protocols that use HTTP APIs, plugins, or public master lists.
  • PHPStan at maximum level, PHPUnit coverage for captured protocol responses, and automated compatibility checks against GameQ 4.0.0.

Installation

Composer is recommended:

composer require softcreatr/gameq:^5.0

GameQ requires PHP 8.1 or newer and the bz2, curl, libxml, simplexml, and xml extensions. See the installation guide for standalone loading and platform details.

Quick start

<?php

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

use GameQ\GameQ;

$gameQ = new GameQ();
$gameQ->addServers([
    [
        'id' => 'source-server',
        'type' => 'css',
        'host' => '192.0.2.10:27015',
    ],
    [
        'id' => 'unreal-server',
        'type' => 'ut2004',
        'host' => '192.0.2.20:7777',
    ],
]);

$gameQ
    ->setOption('timeout', 5)
    ->setOption('max_servers_per_batch', 50);

$results = $gameQ->process();

if ($results['source-server']['gq_online']) {
    printf(
        "%s: %d/%d players\n",
        $results['source-server']['gq_hostname'],
        $results['source-server']['gq_numplayers'],
        $results['source-server']['gq_maxplayers'],
    );
}

The port in host is always the client/connect port. GameQ calculates the query port where a protocol has a known offset; use the per-server query_port option when the server uses a custom query port.

Documentation

Project documentation is maintained in the separate GameQ Wiki, updated from the useful parts of the upstream wiki for this fork and version 5.

Start here Operate GameQ Extend GameQ
Installation Global options Architecture
Quick start and examples Results and normalized fields Adding a protocol
Server definitions and ports Performance and batching Tests and fixtures
Supported identifiers and protocol families Troubleshooting Upgrading from 4.x

Protocol-specific credentials and HTTP endpoints need additional care. Read protocol options and security guidance before exposing queries through a public application.

Support and contributing

License

GameQ is licensed under the GNU Lesser General Public License 3.0 or later.