1. Go to this page and download the library: Download anvilm/php.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.
<?phprequire_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
anvilm / php.rcon example snippets
useAnvilM\RCON\Clients\Minecraft\MinecraftClient;
$Ip = '127.0.0.1'; //Server IP
$Port = 25575; //RCON port
$Client = new MinecraftClient($Ip, $Port);
useAnvilM\RCON\RCONClient;
useAnvilM\RCON\Entity\RCON;
$client = new RCONClient('127.0.0.1', 25575);
// Minecraft authorization
$data = new RCON(1, 3, '123');
// Returns new RCON(1, 2, '')
$response = $client->request($data);
useAnvilM\RCON\RCONClient;
$client = new RCONClient('127.0.0.1', 25575);
$connection = $client->getConnection();
// Close connection and create new socket
$connection->close();
// Open connection with new socket
$connection->open()
// Auth with new socket
$client->request(
new RCON(1, 3, '123')
);
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.