Unoffical API for Cloud Royale. (They don't have any offical API at the moment.)
composer require s4wny/cloud-royale-api
Example usage:
<?php
require_once __DIR__ . '/vendor/autoload.php'; // Autoload files using Composer autoload
use CloudRoyaleAPI\CloudRoyaleAPI;
$api = new CloudRoyaleAPI("[email protected]", "123456");
// Login
var_dump($api->login());
// Get all your servers ( [ID => server name] )
$servers = $api->getServers();
print_r($servers);
// Get status about a specific server
$firstServer = key($servers);
print_r(json_decode($api->getStatus($firstServer)));
/* Output:
bool(true)
Array
(
[0] => Array
(
[ip] => 1.2.3.4
[id] => sadffsd34rfxd3
[name] => http server
[online] => false
)
[1] => Array
(
[ip] => 4.4.4.4
[id] => asfdsadf
[name] => vpn
[online] => true
)
)
stdClass Object
(
[sadffsd34rfxd3] => stdClass Object
(
[status] => On
[memory] => 8
[cpus] => 3
[disk_size] => 30
[disks] => stdClass Object
(
[1337] => stdClass Object
(
[size] => 30
[storage] => 13
)
)
)
)
*/
?>
- __construct($username, $password)
- login()
- getStatus($serverID)
- getServers()
- startServer($serverID)
- stopServer($serverID)
- addSSHKeys($serverID)
- createServer($config)
This library is open-sourced software licensed under the MIT license