Skip to content

s4wny/Cloud-Royale-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Cloud Royale API

Unoffical API for Cloud Royale. (They don't have any offical API at the moment.)

Installation

composer require s4wny/cloud-royale-api

Documentation

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
                        )
                )
        )
)
*/

?>

Methods

  • __construct($username, $password)
  • login()
  • getStatus($serverID)
  • getServers()
  • startServer($serverID)
  • stopServer($serverID)
  • addSSHKeys($serverID)
  • createServer($config)

License

This library is open-sourced software licensed under the MIT license

About

An API for cloud royale

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages