preussio / gameserver
这是一个用于管理通过ssh连接的游戏服务器的SDK。
1.0.0
2017-03-26 17:01 UTC
Requires
- phpseclib/phpseclib: ~2.0
This package is not auto-updated.
Last update: 2020-07-30 23:08:59 UTC
README
安装
要安装此包,请输入以下命令
composer require preussio/gameserver
示例
以下是如何使用接口的一个示例
<?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;
}