1. Go to this page and download the library: Download t0xicvybez/gamequery library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
t0xicvybez / gamequery example snippets
use GameQuery\GameQuery;
$gq = new GameQuery(timeoutMs: 2000, retries: 1);
$gq->addServer('source', '127.0.0.1:27015', id: 'my-css-server');
$gq->addServer('minecraft', 'mc.example.com:25565', id: 'survival');
// Protocols that need credentials take a per-server options bag — the same
// protocol instance serves every server, so nothing is baked into the class.
$gq->addServer('palworld', '203.0.113.10:8212', id: 'pal', options: [
'password' => 'the-admin-password',
]);
foreach ($gq->process() as $result) {
if (!$result->online) {
// errorCode is a stable ErrorCode:: constant (TIMEOUT, UNREACHABLE, ...)
echo "{$result->server->label()} is offline [{$result->errorCode}]\n";
continue;
}
// Normalized accessors read the right field for any protocol.
echo "{$result->name()}: {$result->players()}/{$result->maxPlayers()} players, {$result->pingMs}ms\n";
}
$gq->registerProtocol('yourgame', fn() => new \GameQuery\Protocol\YourGame());
bash
php tests/smoke_test.php # PHP unit suite (offline)
php tests/fuzz_test.php # malformed-input fuzzer (offline)
cd node && npm test # TS unit suite (build + run, offline)
cd node && npm run fuzz # TS fuzzer
php tests/integration.php # optional live checks
cd node && npm run test:integration # (edit the server list first)
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.