This is a very basic game server query framework. It's designed to be easily extendable to accommodate more games. It requires PHP 5.3+.
- Upload the
serverquery/
directory to your website- If you are using the cache (default/recommended), make sure the
serverquery/cache/
directory is writable
- If you are using the cache (default/recommended), make sure the
- Rename
config.example.php
toconfig.php
and edit it with your settings, games, and servers- Edit
template.php
and/orserverquery.css
as needed
- Edit
- Include
serverquery/serverquery.php
usinginclude
orrequire
somewhere on your webpage
All configuration settings are in config.php
. Each option is well documented in a docblock, so refer to those for details.
Each game class can accept an array of options specific to that game engine. Each array in $games
and $servers
can have a config
key that is an associative array of options. Options set in $servers
override options set in $games
.
Here are the available options and default settings for each included game class:
Option | Type | Default | Description |
---|---|---|---|
hideBots | boolean | true |
Hide bots from player count and list |
Option | Type | Default | Description |
---|---|---|---|
useQuery | boolean | false |
Use the Query protocol (server must set enable-query=true ) |
queryPort | integer | 25565 |
Port used by the Query protocol (server query.port property) |
useLegacy | boolean | false |
Use the pre-1.7 Server List Ping protocol (overrides useQuery ) |
Option | Type | Default | Description |
---|---|---|---|
queryPort | integer | 7878 |
Port used to query the server REST API |
Option | Type | Default | Description |
---|---|---|---|
queryPort | integer | 10011 |
Port used by the ServerQuery protocol |
queryUser | string | Username for the ServerQuery protocol | |
queryPass | string | Password for the ServerQuery protocol |
With cron mode enabled, the servers must be queried by cron.php
. For best results, execute the script once every 1 minute.
On linux, this can be achieved by adding a line to your crontab like the one below.
* * * * * php /path/to/cron.php > /dev/null 2>&1
This project is released under the MIT License.
- Aug 21, 2015 [v.0.2.0]
- Uses namespaces (requires PHP 5.3+)
- Switched to JSON format to store cache data
- Aug 03, 2015 [v.0.1.0]
- Initial release