PHP code example of christhompsontldr / phpsdk

1. Go to this page and download the library: Download christhompsontldr/phpsdk 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/ */

    

christhompsontldr / phpsdk example snippets




namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Cloudways\Lists\Lists;

class ApiController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        //
        $list = new Lists();
        $result = [];
        $result[] = $list->getServerRegions();
        $result[] = $list->getCloudProviders();
        $result[] = $list->getServerSizes();
        $result[] = $list->getApps();
        $result[] = $list->getPackages();
        $result[] = $list->getSettings();
        $result[] = $list->getBackupFrequencies();
        $result[] = $list->getCountries();
        $result[] = $list->getMonitorDurations();
        $result[] = $list->getMonitorTargets();
        return $result;
    }
}

#!php


ys\Server\Server;

$server = new Server();
$server->SetEmail("[email protected]");
$server->SetKey("gR1YywOMN2gG8L0FZC6Rd3QSsr0jlM");

$value['cloud'] = "do";
$value['region'] ="lon1";
$value['instance_type'] ="512MB";
$value['memory_size'] ="";
$value['application'] ="phpstack";
$value['app_version'] ="5.4";
$value['project_name'] ="";
$value['this->server_label'] ="abc";
$value['app_label'] ="abc";
$value['db_volume_size'] ="";
$value['data_volume_size'] ="";

$result = $server->create_server($value);