https://github.com/jgniecki/minecraftrcon
🐘 PHP library to request RCON for Minecraft servers
https://github.com/jgniecki/minecraftrcon
library minecraft php rcon server
Last synced: 5 months ago
JSON representation
🐘 PHP library to request RCON for Minecraft servers
- Host: GitHub
- URL: https://github.com/jgniecki/minecraftrcon
- Owner: jgniecki
- License: mit
- Created: 2024-07-28T18:19:32.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-28T18:23:07.000Z (almost 2 years ago)
- Last Synced: 2025-10-28T03:47:31.137Z (8 months ago)
- Topics: library, minecraft, php, rcon, server
- Language: PHP
- Homepage: https://packagist.org/packages/dev-lancer/minecraft-rcon
- Size: 3.91 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Minecraft Rcon
==================




PHP library to request RCON for Minecraft servers
## Installation
### Using Composer
This Rcon library may be installed by issuing the following command:
```bash
$ composer require dev-lancer/minecraft-rcon
```
## 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.
```php
$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 DevLancer\MinecraftRcon;
$rcon = new Rcon($host, $port, $password, $timeout);
if ($rcon->connect()) {
if ($rcon->sendCommand("say Hello World!") === false) {
//bad request
} else {
echo $rcon->getResponse(); //success
}
} else {
echo $rcon->getResponse(); //error
}
```