PHP code example of deliciousbrains / spinupwp-php-sdk
1. Go to this page and download the library: Download deliciousbrains/spinupwp-php-sdk 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/ */
deliciousbrains / spinupwp-php-sdk example snippets
$spinupwp = new SpinupWp\SpinupWp('API_TOKEN');
// Return a collection of servers
$servers = $spinupwp->servers->list();
// Return a single server
$server = $spinupwp->servers->get($serverId);
// Create and return a new server
$server = $spinupwp->servers->create([]);
// Delete a server
$eventId = $spinupwp->servers->delete($serverId, $deleteOnProvider);
// Reboot a server
$eventId = $spinupwp->servers->reboot($serverId);
// Restart the Nginx service on a server
$eventId = $spinupwp->servers->restartNginx($serverId);
// Restart all versions of the PHP-FPM service installed on a server
$eventId = $spinupwp->servers->restartPhp($serverId);
// Restart the MySQL or MariaDB service on a server
$eventId = $spinupwp->servers->restartMysql($serverId);
// Return a collection of this server's sites
$sites = $server->sites();
// Delete the current server
$server->delete($deleteOnProvider);
// Reboot the current server
$server->reboot();
// Restart the Nginx service on the current server
$server->restartNginx();
// Restart all versions of the PHP-FPM service installed on the current server
$server->restartPhp();
// Restart the MySQL or MariaDB service on the current server
$server->restartMysql();
// Return a collection of sites
$sites = $spinupwp->sites->list();
// Return a single site
$site = $spinupwp->sites->get($siteId);
// Create and return a new site
$site = $spinupwp->sites->create($serverId, []);
// Delete a site
$eventId = $spinupwp->sites->delete($siteId);
// Run a git deployment
$eventId = $spinupwp->sites->gitDeploy($siteId);
// Purge a site's page cache
$eventId = $spinupwp->sites->purgePageCache($siteId);
// Purge a site's object cache
$eventId = $spinupwp->sites->purgeObjectCache($siteId);
// Reset a site's file permissions
$eventId = $spinupwp->sites->correctFilePermissions($siteId);
// Delete the current site
$site->delete();
// Run a git deployment
$site->gitDeploy();
// Purge a site's page cache
$site->purgePageCache();
// Purge a site's object cache
$site->purgeObjectCache();
// Reset a site's file permissions
$site->correctFilePermissions();
// Return a collection of events
$events = $spinupwp->events->list();
// Return a single event
$event = $spinupwp->events->get($eventId);
$servers = $spinupwp->servers->list();
// Return an array of all servers
$servers->toArray();
// Return the total number of servers
$servers->count();
// Lazily iterate over all servers
foreach ($servers as $server) {
// Do something with $server
}
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.