This SDK helps you make API calls to the RunCloud Version 2 API and is a fork of the RunCloud PHP SDK.
Install the SDK in your project using Composer:
composer require onhover/runcloud-sdk
Use Composer's autoload:
require __DIR__ . '/../vendor/autoload.php';
Create an instance of the SDK:
$runcloud = new OnHover\RunCloud\RunCloud('MY_API_KEY', 'MY_API_SECRET');
You can use the $runcloud
instance to make all available API calls.
To find out all available methods, inspect the appropriate classes in the Actions
directory. The names of these classes and functions closely follow the
RunCloud API Documentation.
$response = $runcloud->ping();
This tests the connection to the API and should return the string "pong".
$servers = $runcloud->servers();
This will return an array of servers you have access to. Each array item will be
an instance of OnHover\RunCloud\Resources\Server
and contains various properties
such as id
, name
, provider
and ipAddress
.
You can return a single Server instance like this:
$serverId = 12345;
$server = $runcloud->server($serverId);
Some methods require parameters to be supplied as an array.
$serverId = 12345;
$data = [
'type' => 'global',
'port' => '8080-8081',
'protocol' => 'tcp',
];
$rule = $runcloud->createFirewallRule($serverId, $data);
If you discover any security related issues, please email code@onhover.co.uk instead of using the issue tracker.
This package uses code from and is greatly inspired by the Forge SDK package by Mohammed Said and the Oh Dear PHP SDK package.
The MIT License (MIT). Please see License File for more information.