Coder Social home page Coder Social logo

cloudways-api's Introduction

Cloudways API

This API is built to make your coding experience less stressful and help you get started without the hassle of extra codes. This package contains a class with all the functions which are available on the official API Documentation of Cloudways.

Please bare in mind that some of these functions may not work as intended as Cloudways API is still on beta version. Some of the URL's does not output the expected results.

Installation

composer require armagedan/cloudways-api

This package requires guzzlehttp to work but it will automatically be installed with this package. If you are still having trouble with guzzle, manually install with:

composer require guzzlehttp/guzzle

For normal use cases, or if you want to just include the class file separately, feel free for download the file and use it at your convenience.

Usage

As mentioned earlier, the class contains all the RESTAPI calls available in Cloudways. To see the available functions, please visit the cloudways official documentation at: https://developers.cloudways.com/docs/ Here you will find all the information, required parameters and types of values required.

Basic Usage:

//Here is where you define the email address and your API key from Cloudways  
$CW_API = new CloudwaysAPIClient('[email protected]', '40tYp21iqEvwIVelOc4mZNeZkrRtdO');  

//Magic
$server_settings = $CW_API->get_server_settings('12345');  

//object to json
$json = json_encode($server_settings);  

//json to json array
$decode = json_decode($json, true);  

return $decode;

Expected Result:

{"settings":{"apc.shm_size":"32","character_set_server":"ascii","date.timezone":"","display_errors":"Off","error_reporting":"E_ALL & ~E_DEPRECATED & ~E_STRICT","execution_limit":"60","innodb_buffer_pool_size":"","innodb_lock_wait_timeout":"","key_buffer_size":"","max_connections":"150","max_input_time":"60","max_input_vars":"2500","memory_limit":"128","mod_xdebug":"disable","nginx_http2":"enable","package_versions":{"fpm":"enable","mariadb":"","mysql":"5.7","php":"7.3","redis":""},"short_open_tag":"off","static_cache_expiry":"43200","upload_size":"10","wait_timeout":""}}

The result originally comes as an object and we are using the json_encode to change it to a json. And afterwards we use the json_decode with the second parameter true to change it to a json array. And the output is as shown on the above example.

There are approximately a 140 functions which are available from the Cloudways docs. The function names are respective to the names given in the Cloudways docs.

Please refer to the Functions List for all the available functions and required parameters.

Feel free to open any suggestions or issues. Your suggestions and helps are always open. Happy Coding! :)

cloudways-api's People

Contributors

armageddan avatar mohamedshuaau avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.