Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Phpsdk Laravel Package

christhompsontldr/phpsdk

PHP SDK for the Cloudways API. Install via Composer, authenticate with your email and API key, and manage Cloudways resources like servers, regions, providers, sizes, and apps. Includes helpers to check and wait for async operation status/results.

View on GitHub
Deep Wiki
Context7

A PHP-SDK for Cloudways API.

You can clone it to start working on it or use composer to install it.

Type the following command to install SDK using composer

$composer require "cloudwaysapi/phpsdk:1.0.0.x-dev"

Or create a new file name it composer.json and paste the following code in it.

    {
    	"require": {
    		        "cloudwaysapi/phpsdk" : "1.0.0.x-dev"
    	    }
    }

Cloudways API PHP-SDK also provides you two function to check the status of operation id. The first is getOperation($operationid) which will return the result from which you have to extract whether the operation is completed. The second one is getOperationResult($operationid, $wait) which take the $operationid and $wait parameter (in seconds) and returns true when the operation is completed. If it reaches the maximum execution time for PHP, the code will stop and you need to run the function again.

To learn more about using it read the following guide: Possibilities of Cloudways API PHP-SDK.

Creating a New Server#

#!php

<?php
require "vendor/autoload.php";

use Cloudways\Server\Server;

$server = new Server();
$server->SetEmail("ahmed.khan@cloudways.com");
$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);

#Using this SDK in Laravel

For laravel define email and api key in .env file

CW_EMAIL=ahmed.khan@cloudways.com
CW_API_KEY=gR1YywOMN2gG8L0FZC6Rd3QSsr0jlM

Then in your control add the namespace and start using it.

<?php

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;
    }
}
?>
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport