1. Go to this page and download the library: Download ploi/ploi-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/ */
ploi / ploi-php-sdk example snippets
$ploi = new \Ploi\Ploi($apiToken);
// or
$ploi = new \Ploi\Ploi();
$ploi->setApiToken($token);
// List servers
$ploi->servers()->get();
// Get a specific server with ID 123
$ploi->servers(123)->get();
// or
$ploi->servers()->get(123);
// Throws Ploi\Exceptions\Resource\RequiresId
$ploi->servers()->delete();
// Will attempt to delete server by ID
$ploi->servers()->delete(123);
// or
$ploi->servers(123)->delete();
$ploi->servers()->startInstallation($installationUrl);
// or
$ploi->servers(123)->startInstallation();
// Get server list
$ploi->servers()->get();
// Paginate servers
$ploi->servers()->perPage($amountPerPage)->page($pageNumber);
// or
$ploi->servers()->page($pageNumber, $amountPerPage);
// Get server
$ploi->servers(123)->get();
// Delete server
$ploi->servers(123)->delete();
// Get server logs
$ploi->servers(123)->logs();
// Restart server
$ploi->servers(123)->restart();
// Get server monitoring
$ploi->servers(123)->monitoring();
// Get PHP versions installed on server
$ploi->servers(123)->phpVersions();
// Enable opcache
$ploi->servers(123)->opcache()->enable();
// Disable opcache
$ploi->servers(123)->opcache()->disable();
// Refresh opcache
$ploi->servers(123)->opcache()->refresh();
//Create site
$ploi->servers(123)->sites()->create(
$domain,
$webDirectory = '/public',
$projectDirectory = '/',
$systemUser = 'ploi',
$systemUserPassword = null,
$webserverTemplate = null,
$projectType = null
);
// List sites
$ploi->servers(123)->sites()->get();
// Paginate sites
$ploi->servers(123)->sites()->perPage(15)->page(1);
// Get site
$ploi->servers(123)->sites(123)->get();
// Delete site
$ploi->servers(123)->sites(123)->delete();
// Update site
$ploi->servers(123)->sites(123)->update($rootDomain);
// Get site logs
$ploi->servers(123)->sites(123)->logs();
// Set PHP version for site to use
$ploi->servers(123)->sites(123)->phpVersion($phpVersion);
// Enable test domain on site
$ploi->servers(123)->sites(123)->enableTestDomain();
// Disable test domain on site
$ploi->servers(123)->sites(123)->disableTestDomain();
// Get test domain details for site
$ploi->servers(123)->sites(123)->testDomain();
// Suspend site
$ploi->servers(123)->sites(123)->suspend($id = null, $reason = null);
// Resume site
$ploi->servers(123)->sites(123)->resume();
// Get Laravel Horizon statistics
$ploi->servers(123)->sites(123)->horizonStatistics($type);
// Create auth user
$ploi->servers(123)->sites(123)->authUser()->create(
$name,
$password
);
// List auth users
$ploi->servers(123)->sites(123)->authUser()->get();
// Paginate auth users
$ploi->servers(123)->sites(123)->authUser()->perPage($amountPerPage)->page($pageNumber);
// Get auth user
$ploi->servers(123)->sites(123)->authUser(123)->get();
// Delete auth user
$ploi->servers(123)->sites(123)->authUser(123)->delete();
// Get default deploy script
$ploi->servers(123)->sites(123)->deployment()->deployScript();
// Update default deploy script
$ploi->servers(123)->sites(123)->deployment()->updateDeployScript($script = '');
// Deploy a site
$ploi->servers(123)->sites(123)->deployment()->deploy();
// Deploy a staging site to production
$ploi->servers(123)->sites(123)->deployment()->deployToProduction();
// Get .env for site
$ploi->servers(123)->sites(123)->environment()->get();
// Update .env for site
$ploi->servers(123)->sites(123)->environment()->update($content);
// List monitors
$ploi->servers(123)->sites(123)->monitors()->get();
// Paginate monitors
$ploi->servers(123)->sites(123)->monitors()->perPage($amountPerPage)->page($pageNumber);
// Get specific monitor
$ploi->servers(123)->sites(123)->monitors(123)->get();
// Get uptime responses
$ploi->servers(123)->sites(123)->monitors(123)->uptimeResponses();
// Restart service
$ploi->servers(123)->services($name)->restart();
// Create system user
$ploi->servers(123)->systemUsers()->create(
$name,
$sudo = false
);
// List system users
$ploi->servers(123)->systemUsers()->get();
// Paginate system users
$ploi->servers(123)->systemUsers()->perPage($amountPerPage)->page($pageNumber);
// Get system users
$ploi->servers(123)->systemUsers(123)->get();
// Delete system user
$ploi->servers(123)->systemUsers(123)->delete();
// List insights
$ploi->servers(123)->insights()->get();
// Paginate insights
$ploi->servers(123)->insights()->perPage($amountPerPage)->page($pageNumber);
// Get insight
$ploi->servers(123)->insights(123)->get();
// Get insight detail
$ploi->servers(123)->insights(123)->detail();
// Automatically fix insight
$ploi->servers(123)->insights(123)->automaticallyFix();
// Ignore insight
$ploi->servers(123)->insights(123)->ignore();
// Delete insight
$ploi->servers(123)->insights(123)->delete();
// Get own user information
$ploi->user()->get();
// List server providers
$ploi->user()->serverProviders();
// Get server providers
$ploi->user()->serverProviders($providerId);
// List status pages
$ploi->statusPage()->get();
// Paginate status pages
$ploi->statusPage()->perPage($amountPerPage)->page($pageNumber);
// Get status page
$ploi->statusPage(123)->get();