Skip to content
Snippets Groups Projects
Miniontoby's avatar
Miniontoby authored
ec8874bf
History

Minecraft Server Status Handler

A Handler for Lukasss93's PHP library to check Minecraft Servers Status

Installation

To install you need to clone this repo first:

git clone https://edugit.org/Miniontoby/minecraft-server-status-handler.git
cd minecraft-server-status-handler/

Then copy the MCHandler.php, minecraft.css, pack.png and vendor/ to your website folder

Usage

Add the minecraft.css stylesheet to your website in your head tag:

<link rel="stylesheet" href="minecraft.css">

Then somewhere in your body tag where you want your server status add this:

<?php
include_once('MCHandler.php');
echo MCHandler::HandleServers([
        ['hostname' => 'play.cubecraft.com']
]);
?>

And if you now go to your website, you should be able to see the Cubecraft server status

Configuration

For the MCHandler::HandleServers you need to supply settings. These settings are in an array inside an array, so you can do multiple servers at a time

You can add the following parameters for each server:

Parameter Type Default Description
hostname string 127.0.0.1 Server Hostname or IP address
port int 25565 Server port
type string java java or bedrock
method string ping ping or query