onhover/runcloud-sdk

RunCloud PHP SDK (Unofficial)

v1.1.1 2019-09-24 21:16 UTC

This package is auto-updated.

Last update: 2024-04-25 09:32:25 UTC


README

This SDK helps you make API calls to the RunCloud Version 2 API and is a fork of the RunCloud PHP SDK.

RunCloud API Documentation

Installation

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');

Usage

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.

Examples

$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);

Security

If you discover any security related issues, please email code@onhover.co.uk instead of using the issue tracker.

Credits

This package uses code from and is greatly inspired by the Forge SDK package by Mohammed Said and the Oh Dear PHP SDK package.

License

The MIT License (MIT). Please see License File for more information.