PHP SDK
Compute
Virtual machines, flavors, images, and keypairs
18 methods
listFlavors()
List flavors
Parameters
limitinteger
- Maximum number of items to return
markerstring
- ID of the last item from the previous page (for pagination)
min_raminteger
- Filter by minimum RAM (MB)
min_diskinteger
- Filter by minimum disk (GB)
min_vcpusinteger
- Filter by minimum vCPUs
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->compute->listFlavors();print_r($result);
getFlavor()
Get flavor
Parameters
flavor_idstring
required- Flavor ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->compute->getFlavor(['flavor_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
listImages()
List images
Parameters
limitinteger
- Maximum number of items to return
markerstring
- ID of the last item from the previous page (for pagination)
namestring
- Filter by name (exact match or prefix with *)
statusstring
- Filter by status
tagsstring
- Filter by tags (comma-separated)
visibilitystring
- Filter by visibility
os_distrostring
- Filter by OS distribution
os_versionstring
- Filter by OS version
architecturestring
- Filter by architecture
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->compute->listImages();print_r($result);
getImage()
Get image
Parameters
image_idstring
required- Image ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->compute->getImage(['image_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
listInstances()
List instances
Parameters
limitinteger
- Maximum number of items to return
markerstring
- ID of the last item from the previous page (for pagination)
namestring
- Filter by name (exact match or prefix with *)
statusstring
- Filter by status
tagsstring
- Filter by tags (comma-separated)
flavor_idstring
- Filter by flavor ID
image_idstring
- Filter by image ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->compute->listInstances();print_r($result);
createInstance()
Create instance
Parameters
namestring
requireddescriptionstring
flavor_idstring
required- Flavor ID
image_idstring
- Image ID (required if not booting from volume)
key_namesarray
- SSH keypair names to authorize on the instance
security_groupsarray
- Security group names or IDs
networksarray
- Networks to attach
assign_public_ipboolean
- Assign a public IP address to the instance
volumesarray
- Volume attachments for boot from volume
metadataobject
tagsarray
user_datastring
- Base64-encoded user data (cloud-init)
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->compute->createInstance(['name' => 'web-server-01','flavor_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
getInstance()
Get instance
Parameters
instance_idstring
required- Instance ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->compute->getInstance(['instance_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
updateInstance()
Update instance
Parameters
instance_idstring
required- Instance ID
namestring
descriptionstring
metadataobject
tagsarray
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->compute->updateInstance(['instance_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
deleteInstance()
Delete instance
Parameters
instance_idstring
required- Instance ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->compute->deleteInstance(['instance_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
getInstanceConsole()
Get instance console
Parameters
instance_idstring
required- Instance ID
typestring
- Console type
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->compute->getInstanceConsole(['instance_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
rebootInstance()
Reboot instance
Parameters
instance_idstring
required- Instance ID
typestring
- Reboot type
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->compute->rebootInstance(['instance_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
resizeInstance()
Resize instance
Parameters
instance_idstring
required- Instance ID
flavor_idstring
required- New flavor ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->compute->resizeInstance(['instance_id' => '550e8400-e29b-41d4-a716-446655440000','flavor_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
startInstance()
Start instance
Parameters
instance_idstring
required- Instance ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->compute->startInstance(['instance_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
stopInstance()
Stop instance
Parameters
instance_idstring
required- Instance ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->compute->stopInstance(['instance_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
listKeypairs()
List keypairs
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->compute->listKeypairs();print_r($result);
createKeypair()
Create keypair
Parameters
namestring
requiredpublic_keystring
- SSH public key (if not provided, a new keypair will be generated)
typestring
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->compute->createKeypair(['name' => 'my-keypair']);print_r($result);
getKeypair()
Get keypair
Parameters
keypair_namestring
required- Keypair name
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->compute->getKeypair(['keypair_name' => 'example']);print_r($result);
deleteKeypair()
Delete keypair
Parameters
keypair_namestring
required- Keypair name
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->compute->deleteKeypair(['keypair_name' => 'example']);print_r($result);