preussio/gameserver

This is a SDK to manage a game server connected with ssh.

1.0.0 2017-03-26 17:01 UTC

This package is not auto-updated.

Last update: 2020-07-30 23:08:59 UTC


README

Installation

To install this package, please enter the following command:

composer require preussio/gameserver

Examples

Here is an example of how to use the interfaces:

<?php
require_once __DIR__.'/vendor/autoload.php';

use PreussIO\Gameserver\Gameserver;

$gameserver = new Gameserver("example.com", [
    'username' => 'username',
    'password' => 'password',
]);

// Checks if an game server is running.
if($gameserver->isRunning()) {
    echo "Server is running.";
} else {
    echo "Server is not running.";
}

// Starts an game server.
$gameserver->start();

// Stops an game server.
$gameserver->stop();

// Sends a command to the game server.
$gameserver->sendCommand('say Hello World!');

// Display the log of the game server.
$lines = $gameserver->getConsole();
foreach ($lines as $line) {
    echo $line;
}