Simple Rcon class for php.

Maintainers

Package info

github.com/thedudeguy/PHP-Minecraft-Rcon

pkg:composer/thedudeguy/rcon

Statistics

Installs: 59 882

Dependents: 1

Suggesters: 0

Stars: 162

Open Issues: 15

v1.0.0 2017-05-25 06:50 UTC

This package is not auto-updated.

Last update: 2026-03-29 11:11:15 UTC


README

Scrutinizer Code Quality

Simple Rcon class for php.

Installation

Using Composer

This Rcon library may be installed by issuing the following command:

$ composer require thedudeguy/rcon

Not Using Composer

If not using Composer, just place the Rcon.php file in your project and include it in your PHP script:

require_once('Rcon.php');

Example

For this script to work, rcon must be enabled on the server, by setting enable-rcon=true in the server's server.properties file. A password must also be set, and provided in the script.

$host = 'some.minecraftserver.com'; // Server host name or IP
$port = 25575;                      // Port rcon is listening on
$password = 'server-rcon-password'; // rcon.password setting set in server.properties
$timeout = 3;                       // How long to timeout.

use Thedudeguy\Rcon;

$rcon = new Rcon($host, $port, $password, $timeout);

if ($rcon->connect())
{
  $rcon->sendCommand("say Hello World!");
}