Skip to content

PSR-4 compliant PHP library to communicate with emulators adhering to the RetroRCON standard

License

Notifications You must be signed in to change notification settings

emansom/retrorcon-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

PSR-4 compliant PHP library to communicate with emulators adhering to the RetroRCON standard

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published