PHPackages                             randomhost/mcstat - 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. randomhost/mcstat

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

randomhost/mcstat
=================

Retrieves status information from a Minecraft server.

0.0.2(9y ago)021411MITPHPPHP &gt;=5.3.0

Since Oct 3Pushed 3y ago4 watchersCompare

[ Source](https://github.com/randomhost/mcstat)[ Packagist](https://packagist.org/packages/randomhost/mcstat)[ Docs](https://www.random-host.com)[ RSS](/packages/randomhost-mcstat/feed)WikiDiscussions main Synced yesterday

READMEChangelog (2)Dependencies (3)Versions (4)Used By (1)

[![Build Status](https://camo.githubusercontent.com/ebe42b88963b39d5b5a2a2237704543f43aee15b9138683af23c38311ee37cdf/68747470733a2f2f7472617669732d63692e6f72672f72616e646f6d686f73742f6d63737461742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/randomhost/mcstat)

randomhost/mcstat
=================

[](#randomhostmcstat)

PHP class, web page, CLI tool, and [Munin](http://munin-monitoring.org/) plugin to get information from a [Minecraft](http://www.minecraft.net/) server.

This package is a fork of [winny-/mcstat](https://github.com/winny-/mcstat) which cleans up the package and adds Composer support so it can be used within other Composer packages.

Protocol Support
----------------

[](#protocol-support)

mcstat supports [Server List Ping](http://wiki.vg/Server_List_Ping) as seen in `1.7` and later, and `1.5.2`. Server List Ping `1.5.2` works for older Minecraft servers (all the way back to `1.4.2`), while the `1.7` Server List Ping should be used for newer setups. mcstat also supports the UDP full and basic [Query](http://wiki.vg/Query) protocols.

Usage
-----

[](#usage)

### minecraft\_users\_ — A Munin plugin

[](#minecraft_users_--a-munin-plugin)

[![Screenshot of the minecraft_users_ plugin](src/data/munin-plugin.png)](src/data/munin-plugin.png)

Install `minecraft_users_` like any other munin plugin:

```
# compile stand-alone minecraft_users_ script
make

# copy the compiled script file to the munin plugins directory
cp src/bin/minecraft_users_ /usr/share/munin/plugins/minecraft_users_

# ensure that munin can execute the script
chmod 755 /usr/share/munin/plugins/minecraft_users

# create symlinks for the desired Minecraft server hostname and port
export hostname="localhost"
export port=25565
ln -s /usr/share/munin/plugins/minecraft_users_ \
    /etc/munin/plugins/minecraft_users_${hostname}:${port}

# reload munin service
service munin-node reload
```

No configuration is necessary because `minecraft_users_` is a wildcard plugin.

### mcstat as a program

[](#mcstat-as-a-program)

`src/bin/mcstat.php` is a script for querying Minecraft servers. You can install a stand-alone version like so:

```
make
cp src/bin/mcstat ~/bin/mcstat
```

It's very simple and gets the job done:

```
mcstat play.gotpvp.com
```

This will output the status of the given server like so:

```
play.gotpvp.com 1.7.4 2714/5000 131ms
Uberminecraft Cloud | 22 Games
1.7 Play Now!

```

*Please note: [`TERM` must be set to a known terminal](https://github.com/nodesocket/commando/issues/9), otherwise PHP spams stderr unconditionally.*

### stat.php

[](#statphp)

`src/www/stat.php` is a simple web page that lets users query a given server.

**Note:** `stat.php` shouldn't be used on a public server as it's not well tested!

[![Screenshot of stat.php](src/data/minecraft-server-status.png)](src/data/minecraft-server-status.png)

### Usage as a PHP Class

[](#usage-as-a-php-class)

```
