PHP code example of cedricziel / php-hetzner-cloud-api
1. Go to this page and download the library: Download cedricziel/php-hetzner-cloud-api library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
cedricziel / php-hetzner-cloud-api example snippets
$token = '...';
// create an api client
$client = new \CedricZiel\HetznerCloudAPI\Client();
// set the credentials on your client
$client->authenticate($token);
// retrieve a list of servers
$client->servers->all();
// retrieve all actions
$actions = $client->actions->all();
// get one action
$action = $client->actions->show($actionId);
// retrieve all images
$images = $client->images->all();
// get one image
$image = $client->images->show($imageId);
// retrieve all prices
$prices = $client->pricing->all();
// retrieve all servers
$server = $client->servers->all();
// get one server
$server = $client->servers->show($serverId);
// create a server
$server = $client->servers->create($parameters);
// rename a server
$server = $client->servers->rename($serverId, $newName);
// remove a server
$client->servers->remove($serverId);