This PHP library is used to get information such as users online, refreshing users' look and doing housekeeping activity such as e.g. sending room alerts by communicating with emulators adhering to the RetroRCON standard.
The project requires PHP 7.2 or higher and uses composer's autoloader following the PSR-4 standard.
- Install and configure the PHP gRPC extension
- Install and configure the PHP Protobuf extension
- Install and learn how to use composer
- Add the composer package to your project by running
composer require ewout/retrorcon
- Make sure to include composer's autoloader
- Look at the snippet below on how to use the library
<?php
// Include the Composer autoloader
include 'vendor/autoload.php';
// Shortcut for the FQN
use RetroRCON\RemoteConnection;
// Create new RCON instance
$rcon = new RemoteConnection(
[
'host' => '127.0.0.1',
'port' => 12309
]
);
// Get online user count
$onlineCount = $rcon->getOnlineCount();
// Is user 'Ewout' online?
$isOnline = $rcon->isUserOnline("Ewout");
// Supports user ID too
$userId = 1;
$isOnline = $rcon->isUserOnline($userId);
// Refresh user figure if online (only meant to be used when figure/motto changed)
if ($isOnline) {
$rcon->refreshLook($userId);
}