kekalainen / gamerq
RCON & query library for various game servers
3.0.0
2023-09-22 15:52 UTC
Requires
- php: >=7.1
Requires (Dev)
None
Suggests
- arthurkushman/php-wss: Required for WebSocket RCON (^1.6)
Provides
None
Conflicts
None
Replaces
None
README
A PHP library for querying various game servers and sending RCON commands to them.
Supported games
This library should support all games that implement the Source query protocol, Source RCON protocol, GameSpy v4 / UT3 query protocol or webrcon. Not all protocol features are implemented. Below is an incomplete table of supported games.
| Game | RCON | Query |
|---|---|---|
| Garry's Mod | ✅ | ✅ |
| Minecraft | ✅ | ✅ |
| Rust | ✅ | ✅ |
Usage examples
RCON
$rcon = new \Kekalainen\GameRQ\Rcon\SourceRcon; // Source games & Minecraft
$rcon = new \Kekalainen\GameRQ\Rcon\WebSocketRcon; // Rust
try {
$rcon->connect($address, $port, $password);
$response = $rcon->command('status');
echo var_dump($response);
} catch (\Exception $exception) {
echo $exception->getMessage();
} finally {
$rcon->disconnect();
}
Query
$query = new \Kekalainen\GameRQ\Query\SourceQuery; // Source games
$query = new \Kekalainen\GameRQ\Query\MinecraftQuery; // Minecraft (TCP)
$query = new \Kekalainen\GameRQ\Query\GameSpy4Query; // Minecraft (UDP)
try {
$query->connect($address, $port);
$info = $query->info();
echo var_dump($info);
} catch (\Exception $exception) {
echo $exception->getMessage();
} finally {
$query->disconnect();
}