All Projects → Lukasss93 → minecraft-server-status

Lukasss93 / minecraft-server-status

Licence: MIT license
PHP library to check Minecraft Servers Status

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to minecraft-server-status

Minestat
📈 A Minecraft server status checker
Stars: ✭ 168 (+366.67%)
Mutual labels:  status, query
connection checker
Android library for checking the internet connectivity of a device.
Stars: ✭ 26 (-27.78%)
Mutual labels:  ping, check
out
Monitor services in your menu bar
Stars: ✭ 155 (+330.56%)
Mutual labels:  status
huebot
Changes a Phillips Hue light's color and flashes based on GitHub's status
Stars: ✭ 34 (-5.56%)
Mutual labels:  status
spring-filter
Painless filtering library for JPA entities and MongoDB collections. Smoothly integrates with Spring APIs.
Stars: ✭ 123 (+241.67%)
Mutual labels:  query
twitter-d
TypeScript types for Twitter API objects
Stars: ✭ 54 (+50%)
Mutual labels:  status
anapsid
An adaptive query processing engine for SPARQL endpoints.
Stars: ✭ 17 (-52.78%)
Mutual labels:  query
elastic-composer
Client-side Elasticsearch query generator and executor. Filter fields, find search suggestions, and paginate query results for your indicies using a simple, reactive, and high-level API
Stars: ✭ 14 (-61.11%)
Mutual labels:  query
gen icmp
ICMP protocol implementation for Erlang without NIFs
Stars: ✭ 26 (-27.78%)
Mutual labels:  ping
CheckableTextView
A simple and flexible Checked TextView or Checkable TextView
Stars: ✭ 108 (+200%)
Mutual labels:  check
AdvancedSQL
The best Java query builder/SQL connector.
Stars: ✭ 23 (-36.11%)
Mutual labels:  query
react-health-check
Lightweight React hook for checking health of API services.
Stars: ✭ 28 (-22.22%)
Mutual labels:  check
uri-query-parser
a parser and a builder to work with URI query string the right way in PHP
Stars: ✭ 38 (+5.56%)
Mutual labels:  query
netcheck
A shell script to check and log when your internet connection goes down.
Stars: ✭ 138 (+283.33%)
Mutual labels:  ping
uptime
GitHub Action to check the status of endpoints
Stars: ✭ 30 (-16.67%)
Mutual labels:  ping
speed-cloudflare-cli
📈 Measure the speed and consistency of your internet connection using speed.cloudflare.com
Stars: ✭ 99 (+175%)
Mutual labels:  ping
upmail
Email notification hook for https://github.com/sourcegraph/checkup.
Stars: ✭ 62 (+72.22%)
Mutual labels:  ping
kirby3-doctor
Plugin to check health of your CMS installation
Stars: ✭ 19 (-47.22%)
Mutual labels:  check
express-mquery
Expose mongoose query API through HTTP request.
Stars: ✭ 37 (+2.78%)
Mutual labels:  query
python-qlient
A fast and modern graphql client designed with simplicity in mind.
Stars: ✭ 29 (-19.44%)
Mutual labels:  query

Minecraft Server Status

Latest Stable Version Total Downloads License PHP

This library can be used to check Minecraft Servers Status for some basic information.

Please do not create issues when you are unable to retrieve information from a server, unless you can prove that there is a bug within the library.

Differences between Ping and Query

There are two methods of retrieving information about a Minecraft server.

  • Ping

    Ping protocol was added in Minecraft 1.7 and is used to query the server for minimal amount of information (hostname, motd, icon, and a sample of players). This is easier to use and doesn't require extra setup on server side. It uses TCP protocol on the same port as you would connect to your server an optional parameter IsOld17 which can be used to query servers on version 1.6 or older. N.B.: this method doesn't work with Minecraft: Bedrock Edition

  • Query

    This method uses GameSpy4 protocol, and requires enabling query listener in your server.properties like this:

    enable-query=true

    query.port=25565

    Query allows to request a full list of servers' plugins and players, however this method is more prone to breaking, so if you don't need all this information, stick to the ping method as it's more reliable.

Requirements

  • PHP >= 5.6
  • Json Extension
  • Iconv Extension

Installation

You can install this library with composer:

composer require lukasss93/minecraft-server-status

Using

MCPing

Using

<?php
	//using the class
	use MCServerStatus\MCPing;
	
	//include composer autoload
	require_once('../vendor/autoload.php');
	
	//checking account
	$response=MCPing::check('hostname or IP');
	
	//get informations from object
	var_dump($response);
	
	//or from array
	var_dump($response->toArray());
?>

If you want to get ping info from a server that uses a version older than Minecraft 1.7, then add true parameter after $timeout.

Please note that this library does resolve SRV records too.

Input

The check() method has 4 optional parameters:

# Parameter Type Default Description
1 host string 127.0.0.1 Server Hostname or IP address
2 port int 25565 Server port
3 timeout int 2 Timeout (in seconds)
4 isOld17 bool false Boolean value to find informations on servers that uses a version older than Minecraft 1.7

Output

The check() method return an object with the following properties:

Key Type Description
online bool Returns true if the server is online else false
error string Returns any error message
hostname string Returns the server hostname or IP address
address string Returns server IP address
port int Returns the server port
ping int Returns server ping
version string Returns the server version
protocol int Returns the server protocol
players int Returns the number of online players
max_players int Returns the maximum number of players that can enter the server
sample_player_list array Returns a partial list of online players
motd string Returns server description
favicon string Returns an image in Base64 string
mods array Returns a list of installed mods on the server

You can use the following methods after check() method:

Method Description
toArray() Return the object properties as an array
getMotdToText() Get the motd without the format codes
getMotdToHtml() Get the motd as HTML

MCQuery

Using

<?php
	//using the class
	use MCServerStatus\MCQuery;
	
	//include composer autoload
	require_once('../vendor/autoload.php');
	
	//checking account
	$response=MCQuery::check('hostname or IP');
	
	//get informations from object
	var_dump($response);
	
	//or from array
	var_dump($response->toArray());
?>

Input

The check() method has 4 optional parameters:

# Parameter Type Default Description
1 host string 127.0.0.1 Server Hostname or IP address
2 port int 25565 Server query port
3 timeout int 2 Timeout (in seconds)
4 resolveSRV bool true Resolve SRV record

Output

The check() method return an array with the following properties:

Key Type Description
online bool Returns true if the server is online else false
error string Returns any error message
hostname string Returns the server hostname or IP address
address string Returns server IP address
port int Returns the server port
version string Returns the server version
software string Returns the server software
game_type string Returns the server software type
game_name string Return the server software name
players int Returns the number of online players
max_players int Returns the maximum number of players that can enter the server
player_list array Returns a list of online players
motd string Returns server description
map string Returns the server map name
plugins array Returns a list of installed plugins on the server

You can use the following methods after check() method:

Method Description
toArray() Return the object properties as an array
getMotdToText() Get the motd without the format codes
getMotdToHtml() Get the motd as HTML

Changelog

All notable changes to this project will be documented here.

Recent changes

[2.0]

  • First release
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].