PHP code example of kylewlawrence / gridpane-api-client-php
1. Go to this page and download the library: Download kylewlawrence/gridpane-api-client-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/ */
kylewlawrence / gridpane-api-client-php example snippets
php
// load Composer
ridPane\Api\HttpClient as GridPaneAPI;
$bearer = "6wiIBWbGkBMo1mRDMuVwkw1EPsNkeUj95PIz2akv"; // replace this with your GridPane Personal Access/Bearer token
$client = new GridPaneAPI();
$client->setAuth('bearer', ['bearer' => $bearer]);
php
// Get all servers
$servers = $client->servers()->getAll();
print_r($servers);
// Create a new server
$newServer = $client->servers()->create([
'servername' => 'hal9000',
'ip' => '199.199.199.199',
'datacenter' => 'space-station-v',
'webserver' => 'nginx',
'database' => 'percona'
]);
print_r($newServer);
// Update a server
$client->servers()->update(12345,[
'security_updates_reboot_time' => '04:00'
]);
// Delete a server
$client->servers()->delete(12345);
// Get all sites
$sites = $client->sites()->getAll();
print_r($sites);