jfitz/rcon

This package is abandoned and no longer maintained. No replacement package was suggested.

Source RCON protocol library for PHP 7

1.1 2021-06-20 15:09 UTC

This package is auto-updated.

Last update: 2023-04-14 15:16:19 UTC


README

RCON is a protocol used by source dedicated servers, which allows console commands to be issued to the server via a "remote console". This library allows for remote execution of game server commands via RCON using PHP 7.

Game servers that support RCON include (but are not limited to):

  • Arma 3
  • Garry's Mod
  • 7 Days To Die
  • Minecraft (Java Edition)
  • Rust
  • Squad
  • ARK: Survival Evolved

Installation

Install using composer:

composer require jfitz/rcon

Usage

# Create new socket
$socket = new \Jfitz\Rcon\Socket('127.0.0.1', 'Password123', 25565, 30);

# Check connection
if ($socket->isConnected()) {
    
    # Execute a command
    $socket->execute('/say Hello World!');
}

Contribution

I welcome contribution to all my repositories, but please note the following rules:

  • Code must follow PSR coding standards
  • Commit messages must follow standards (see bellow)

Commit Messages

Any contributions must follow the commit message standard as shown bellow.

Summary of the change

WHAT / WHY: Description of what the change is and why its being done

HOW: Description of how this commit applies to the change

Issue number (if applicable) 

Example Commit:

Implement support for multi-packet responses

When the response packet exceeds 4096 characters it gets split into multiple packets, we need to add support for this so responses don't get truncated

This commit adds support for multi-packet responses by adding a loop in the execute method that will continue to read packets until the end of the response is found