PHP code example of daverogers / serverpilot-php
1. Go to this page and download the library: Download daverogers/serverpilot-php 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/ */
daverogers / serverpilot-php example snippets
$config = array(
'id' => 'YOURID',
'key' => 'YOURKEY'
);
$sp = new ServerPilot($config);
try {
$servers = $sp->server_list();
} catch(ServerPilotException $e) {
echo $e->getCode() . ': ' .$e->getMessage();
}
$sp->action_info('ACTIONID');
$servers = $sp->server_list();
$server = $sp->server_info('SERVERID');
$server = $sp->server_create('SERVERNAME');
$response = $sp->server_update('SERVERID', 'FIREWALL':bool, 'AUTOUPDATES':bool);
$response = $sp->server_delete('SERVERID');
$systemUsers = $sp->sysuser_list();
$systemUser = $sp->sysuser_info('SERVERID');
$systemUser = $sp->sysuser_create('SERVERID', 'NAME', 'PASSWORD');
$response = $sp->sysuser_update('SERVERID', 'PASSWORD');
$response = $sp->sysuser_delete('SYSUSERID');
$apps = $sp->app_list();
$app = $sp->app_info('APPID');
$app = $sp->app_create('APPNAME', 'SYSUSERID', 'RUNTIME', 'DOMAINS', 'WORDPRESS');
$response = $sp->app_update('APPID', 'RUNTIME', 'DOMAINS');
$response = $sp->app_delete('APPID');
$databases = $sp->database_list();
$app = $sp->database_info('DBID');
$app = $sp->database_create('APPID', 'NAME', 'USERNAME', 'PASSWORD');
$response = $sp->database_update('DBID', 'USERID', 'PASSWORD');
$response = $sp->database_delete('APPID');
$ssl = $sp->ssl_add('APPID', 'KEY', 'CERT', 'CACERTS);
$ssl = $sp->ssl_delete('APPID');
$ssl = $sp->ssl_auto('APPID');
$ssl = $sp->ssl_force('APPID', 'FORCE':bool);
json
{
"rogers/serverpilot-php": "1.*"
}
}