PHP code example of jfitz / rcon

1. Go to this page and download the library: Download jfitz/rcon library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jfitz / rcon example snippets

 

# 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!');
}