Coder Social home page Coder Social logo

wp-serverpilot-api's Introduction

WordPress ServerPilot.io API

A WordPress php library for interacting with the ServerPilot API.

More details can be found at serverpilot.io.

Example Usage

Below is an example of how to use the ServerPilot API to create a new application.

$sp_api = new ServerPilotAPI( 'cid_AbCdEfGhIjKlM', 'a0B1c2D3e4F5g6H7i8J9k0L1m2N3o4P5q6R7s8T9u0V1w2X3' );

// Test authentication.
$response = $sp_api->list_servers();

if ( is_wp_error( $response ) ) {
  echo 'Error authenticating with provided credentials.';
  return;
}

// Authentication was successful.
$servers = $response->data;

// Check if we have any servers
if ( ! count( $servers ) ) {
  // If not, create one.
  $server_id = $sp_api->connect_new_server( 'wp-api-libraries' )->data->id;
}else{
  // You could perform more complicated stuff here (or skip to this step).
  $server_id = $servers[0]->id;
}

// Add an app (or website).
$app = $sp_api->create_app(
  'WordPress',
  server_id,
  'php7.0',
  array( 'wp-api-libraries.com', 'www.wp-api-libraries.com' )
  array(
    'site_title'     => 'My WordPress Site',
    'admin_user'     => 'Bradley M',
    'admin_password' => 'passtheword',
    'admin_email'    => '[email protected]'
  )
); // Note that the actual app details are stored under the ->data property.

wp-serverpilot-api's People

Contributors

bradleymoore111 avatar bhubbard avatar

Watchers

James Cloos avatar Lee Peterson 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.