1. Go to this page and download the library: Download ponasromas/hestiacp-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/ */
ponasromas / hestiacp-api example snippets
use HestiaCP\Client;
use HestiaCP\Authorization\Credentials;
use HestiaCP\Authorization\Host;
// You can choose to use an API Key or username and password (legacy)
$credentials = new Credentials('Key:Secret');
$port = 8083;
$host = new Host('https://server', $credentials, $port);
$client = new Client($host);
$command = new SomeCommand();
$response = $client->send($command);
echo $response->getResponseText();
$userModule = $client->getModuleUser();
$userModule->list(); // returns all users with data
$userModule->detail('admin'); // returns selected user with data
$userModule->changePassword('admin', 'otherPa$$word');
$userModule->add('other_user', 'pa$$word', '[email protected]');
$userModule->suspend('other_user');
$userModule->unsuspend('other_user');
$userModule->delete('other_user');
$backupModule = $client->getModuleBackup('admin'); // backup module needs user
$backupModule->backup(); // create a new backup
$backupModule->delete('admin.2021-10-13_18-12-53.tar'); // delete an user backup
$backupModule->deleteExclusions(); // delete all backup exclusions
$backupModule->listBackups(); // returns the backups list
$backupModule->listBackup('admin.2021-10-13_18-12-53.tar'); // returns backup parameters list
$backupModule->listBackupExclusions(); // returns the backup exclusions list
$dnsModule = $client->getModuleDNS();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.