Repository: FunnyItsElmo/PHP-Minecraft-Server-Status-Query
Branch: master
Commit: bc6a98c6cdb3
Files: 9
Total size: 10.3 KB
Directory structure:
gitextract_1ch6nddx/
├── .gitignore
├── LICENSE
├── README.md
├── composer.json
├── example/
│ └── index.php
└── src/
├── MinecraftServerStatus.php
└── Packets/
├── HandshakePacket.php
├── Packet.php
└── PingPacket.php
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
composer.lock
composer.phar
vendor
.project
.settings
.buildpath
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2021 Julian Spravil
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
# Minecraft Server Status Query [Discontinued]
[](https://packagist.org/packages/funnyitselmo/minecraftserverstatus) [](https://packagist.org/packages/funnyitselmo/minecraftserverstatus) [](https://packagist.org/packages/funnyitselmo/minecraftserverstatus) [](https://packagist.org/packages/funnyitselmo/minecraftserverstatus)
Minecraft Server Status Query, written in PHP, with online players, motd, favicon and more server related informations without plugins and enable-query.
*Tested with Spigot 1.9 and Bungeecord 1.9 & 1.8*
### Installation
```
composer require funnyitselmo/minecraftserverstatus
```
### Tutorial
```Java
use MinecraftServerStatus\MinecraftServerStatus;
require '../vendor/autoload.php';
$response = MinecraftServerStatus::query('lostforce.com', 25565);
if (! $response) {
echo "The Server is offline!";
} else {
echo "
The Server " . $response['hostname'] . " is running on " . $response['version'] . " and is online,
currently are " . $response['players'] . " players online
of a maximum of " . $response['max_players'] . ". The motd of the server is '" . $response['description'] . "'.
The server has a ping of " . $response['ping'] . " milliseconds.";
}
```
If the server is offline MinecraftServerStatus::query returns false else it returns an array which contains the server informations.
### Variables
The following table contains the available variables the response can contain. The default value of each variable is false.
| Array Index | Description |
|---|---|
'hostname' |
Exact server address in 127.0.0.1 format |
'port' |
The servers port for example 25565 |
'ping' |
The time in ms the server needs to answer |
'version' |
The server version (for example: 1.9) |
'protocol' |
The server protocol (for example: 107) |
'players' |
Amount of players who are currently online |
'max_players' |
Number of the slots of the server |
'description' |
The message of the day of the server |
'description_raw' |
The raw version of description (contains color codes etc.) |
'favicon' |
The favicon of the server in a base64 string (Can be displayed with the html img tag by setting the string as src) |
'modinfo' |
Informations about the plugins |