A library to fetch the query information of Minecraft: Bedrock Edition servers
• Install
• Usage
• Examples
• Contribution
• License
This library requires PHP 7.2 or newer in order to work correctly. You can install it with:
$ composer require jarne/querylibrary
If you don't like Composer, you can also clone the repository with:
$ git clone https://github.com/jarne/QueryLibrary
There is only one function called fetch
to get the query information of a server. You must enter the IP of the server. If you don't specify the port or the timeout, it'll use the default port 19132 and a timeout of 5 seconds. The data is returned in a Result
-object which has functions to get each value.
/**
* Fetch query information of a server
*
* @param string $ip
* @param int $port
* @param int $timeoutSeconds
*
* @return Result
*/
public function fetch(
string $ip,
int $port = 19132,
int $timeoutSeconds = 5
): Result
For a list of all available get-value-functions, take a look into the Result.php file.
As an example, we're going to fetch the default level name of a PocketMine-MP server running on the local machine.
$queryLibrary = new QueryLibrary();
$result = $queryLibrary->fetch("127.0.0.1");
echo "The default level name is " . $result->getDefaultLevelName();
Contributions are always very welcome! It's completely equal if you're a beginner or a more experienced developer.
Please read our Contribution Guidelines before creating an issue or submitting a pull request.
Thanks for your interest 🎉👍!