ewout/retrorcon

A PHP library to communicate with emulators adhering to the RetroRCON standard

1.1.0 2018-06-17 13:33 UTC

This package is not auto-updated.

Last update: 2024-03-17 02:20:52 UTC


README

Latest Stable Version License

retrorcon-php

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.

How to use it

  1. Install and configure the PHP gRPC extension
  2. Install and configure the PHP Protobuf extension
  3. Install and learn how to use composer
  4. Add the composer package to your project by running composer require ewout/retrorcon
  5. Make sure to include composer's autoloader
  6. Look at the snippet below on how to use the library

Usage

<?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);
}