PHPackages                             xpaw/php-minecraft-query - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. xpaw/php-minecraft-query

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

xpaw/php-minecraft-query
========================

PHP library to query Minecraft servers

5.0.0(1y ago)74299.8k↓10.8%196[2 issues](https://github.com/xPaw/PHP-Minecraft-Query/issues)3MITPHPPHP &gt;=8.0CI passing

Since Oct 6Pushed 2mo ago39 watchersCompare

[ Source](https://github.com/xPaw/PHP-Minecraft-Query)[ Packagist](https://packagist.org/packages/xpaw/php-minecraft-query)[ RSS](/packages/xpaw-php-minecraft-query/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (2)Versions (7)Used By (3)

PHP Minecraft Query [![Packagist](https://camo.githubusercontent.com/6efdcc4c4be7fbc890b4a3967f165503497436b59ee1b91f9d8df6fe57029e34/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f787061772f7068702d6d696e6563726166742d71756572792e737667)](https://packagist.org/packages/xpaw/php-minecraft-query)
=================================================================================================================================================================================================================================================================================================================================

[](#php-minecraft-query-)

This library can be used to query Minecraft servers 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
----------------------------------

[](#differences-between-ping-and-query)

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

### Ping

[](#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.

`MinecraftPing` class contains a method `QueryOldPre17` which can be used to query servers on version 1.6 or older.

### Query

[](#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.

RCON
----

[](#rcon)

It is possible to send console commands to a Minecraft server remotely using the [Source RCON protocol](https://developer.valvesoftware.com/wiki/Source_RCON_Protocol). Use [PHP Source Query](https://github.com/xPaw/PHP-Source-Query-Class) library for your RCON needs.

SRV DNS record
--------------

[](#srv-dns-record)

This library automatically tries to resolve SRV records. If you do not wish to do so, pass `false` as the fourth param in the constructor (after timeout param).

Installation
------------

[](#installation)

```
composer require xpaw/php-minecraft-query

```

Example
-------

[](#example)

```
require __DIR__ . '/vendor/autoload.php';

use xPaw\MinecraftPing;
use xPaw\MinecraftPingException;

$Query = null;

try
{
	$Query = new MinecraftPing( 'localhost', 25565 );

	print_r( $Query->Query() );
}
catch( MinecraftPingException $e )
{
	echo $e->getMessage();
}
finally
{
	if( $Query !== null )
	{
		$Query->Close();
	}
}
```

If you want to get `ping` info from a server that uses a version older than Minecraft 1.7, then use function `QueryOldPre17` instead of `Query`.

---

If the server has query enabled (`enable-query`), then you can use `MinecraftQuery` to retrieve more information about a server.

```
require __DIR__ . '/vendor/autoload.php';

use xPaw\MinecraftQuery;
use xPaw\MinecraftQueryException;

$Query = new MinecraftQuery( );

try
{
	$Query->Connect( 'localhost', 25565 );

	print_r( $Query->GetInfo( ) );
	print_r( $Query->GetPlayers( ) );
}
catch( MinecraftQueryException $e )
{
	echo $e->getMessage( );
}
```

For Bedrock servers (MCPE) use `ConnectBedrock` instead of `Connect`:

```
require __DIR__ . '/vendor/autoload.php';

use xPaw\MinecraftQuery;
use xPaw\MinecraftQueryException;

$Query = new MinecraftQuery( );

try
{
	$Query->ConnectBedrock( 'localhost', 19132 );

	print_r( $Query->GetInfo( ) );
}
catch( MinecraftQueryException $e )
{
	echo $e->getMessage( );
}
```

License
-------

[](#license)

[MIT](LICENSE)

###  Health Score

60

—

FairBetter than 99% of packages

Maintenance65

Regular maintenance activity

Popularity56

Moderate usage in the ecosystem

Community36

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 78.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~660 days

Recently: every ~725 days

Total

6

Last Release

578d ago

Major Versions

1.0.0 → 2.0.02016-11-06

2.0.0 → 3.0.02019-07-08

3.0.0 → 4.0.02019-12-24

4.0.1 → 5.0.02024-10-17

PHP version history (3 changes)1.0.0PHP &gt;=5.4

4.0.0PHP &gt;=7.0

5.0.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/7e0942af20ff43fb658f834cff0348fe0b2c5d153b7fa9bef0938591edba13fe?d=identicon)[xPaw](/maintainers/xPaw)

---

Top Contributors

[![xPaw](https://avatars.githubusercontent.com/u/613331?v=4)](https://github.com/xPaw "xPaw (100 commits)")[![Lekensteyn](https://avatars.githubusercontent.com/u/164530?v=4)](https://github.com/Lekensteyn "Lekensteyn (6 commits)")[![beefsack](https://avatars.githubusercontent.com/u/232322?v=4)](https://github.com/beefsack "beefsack (6 commits)")[![Wruczek](https://avatars.githubusercontent.com/u/7156344?v=4)](https://github.com/Wruczek "Wruczek (2 commits)")[![barnumbirr](https://avatars.githubusercontent.com/u/2029239?v=4)](https://github.com/barnumbirr "barnumbirr (2 commits)")[![Lulu13022002](https://avatars.githubusercontent.com/u/41980282?v=4)](https://github.com/Lulu13022002 "Lulu13022002 (2 commits)")[![perry-mitchell](https://avatars.githubusercontent.com/u/3869469?v=4)](https://github.com/perry-mitchell "perry-mitchell (2 commits)")[![aaronklaassen](https://avatars.githubusercontent.com/u/1580121?v=4)](https://github.com/aaronklaassen "aaronklaassen (1 commits)")[![zh32](https://avatars.githubusercontent.com/u/856992?v=4)](https://github.com/zh32 "zh32 (1 commits)")[![astei](https://avatars.githubusercontent.com/u/16436212?v=4)](https://github.com/astei "astei (1 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![Erikvv](https://avatars.githubusercontent.com/u/1748197?v=4)](https://github.com/Erikvv "Erikvv (1 commits)")[![Fabrimat](https://avatars.githubusercontent.com/u/13642582?v=4)](https://github.com/Fabrimat "Fabrimat (1 commits)")[![HosfordDotMe](https://avatars.githubusercontent.com/u/555977?v=4)](https://github.com/HosfordDotMe "HosfordDotMe (1 commits)")[![South-Paw](https://avatars.githubusercontent.com/u/2154764?v=4)](https://github.com/South-Paw "South-Paw (1 commits)")

---

Tags

bedrockmcpeminecraftphpraknetminecraft

###  Code Quality

Static AnalysisPHPStan, Psalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/xpaw-php-minecraft-query/health.svg)

```
[![Health](https://phpackages.com/badges/xpaw-php-minecraft-query/health.svg)](https://phpackages.com/packages/xpaw-php-minecraft-query)
```

###  Alternatives

[thedudeguy/rcon

Simple Rcon class for php.

16259.4k1](/packages/thedudeguy-rcon)[spirit55555/php-minecraft

Useful PHP classes for Minecraft

6823.6k](/packages/spirit55555-php-minecraft)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
