PHP code example of mayomi / minecraftserverstatus

1. Go to this page and download the library: Download mayomi/minecraftserverstatus library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mayomi / minecraftserverstatus example snippets


use MinecraftServerStatus\MinecraftServerStatus;

c450.com', 25565);

if (! $response) {
    echo "The Server is offline!";
} else {
    echo "<img width=\"64\" height=\"64\" src=\"" . $response['favicon'] . "\" /> <br>
        服务器地址:" . $response['hostname'] . "<br>
		服务器版本:" . $response['version'] . "<br>
		服务器状态:在线<br>
        服务器人数:" . $response['players'] . " / " . $response['max_players'] . "<br>
		服务器标语:" . $response['description'] . "<br>
        服务器延迟:" . $response['ping'] . " 毫秒";
}