PHP code example of ica4c / albion-status-client
1. Go to this page and download the library: Download ica4c/albion-status-client 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/ */
ica4c / albion-status-client example snippets
use Albion\Status\Client;use Albion\Status\Enums\ServerState;
$client = new Client();
$status = $client->getServiceStatus();
switch ($status->getState()) {
case ServerState::ONLINE:
case ServerState::STARTING:
// Do something while service online/starting;
break;
case ServerState::FAILED:
case ServerState::OFFLINE:
case ServerState::UNRESPONSIVE:
// Do something while service offline;
break;
}
$client = new Client();
$version = $client->getClientVersion();
echo "Android is: {$version->getAndroid()}\n";
echo "IOS is: {$version->getIOS()}\n";
echo "Windows is: {$version->getWindows()}\n";
echo "OSX is: {$version->getOSX()}\n";
echo "Linux is: {$version->getLinux()}\n";