Download the PHP package fernleafsystems/apiwrappers-serverpilot without Composer

On this page you can find all versions of the php package fernleafsystems/apiwrappers-serverpilot. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package apiwrappers-serverpilot

serverpilot-php

Latest Stable Version Total Downloads License

This simple PHP API client binds to ServerPilot's RESTful API that allows you to manage ServerPilot resources. All responses return JSON objects, including errors.

Installation

You can install the bindings via Composer. Add this to your composer.json:

...and then install

Or you can include manually:

Usage

General

Servers

System users

Apps

Databases

SSL

Connect

With your API key and id from ServerPilot, set up the config values and pass them to the ServerPilot class. You may alternatively include a 'decode' => false config value if you just want the raw JSON-encoded value returned.

From there, you can call any number of functions to manage your ServerPilot servers, apps, system users, databases, etc.

Catch errors

If there's a problem with any request a ServerPilotException is thrown.

You can retrieve the error message with getMessage() and the actual HTTP code with getCode().

Actions

Actions are a record of work done on ServerPilot resources. These can be things like the creation of an App, deploying SSL, deleting an old Database, etc.

All methods that modify a resource will return an actionid which can be used to track the status of said action.

Possible values of an action status

Status Description
open Action has not completed yet.
success Action was completed successfully.
error Action has completed but there were errors.

Servers

List all servers

Retrieve an existing server

Connect a new server

Use this method to tell ServerPilot that you plan to connect a new server.

When the request goes through successfully you should get this returned:

With data.id and data.apikey you can run the serverpilot installer on the server you just registered.

Update an existing server

There are 2 options you can change on each server; firewall and auto updates.

Both of these options are booleans (if you don't want to change an option you can define it as null.

Remove an existing server

System users

List all system users

Retrieve an existing system user

Create a new system user

Parameters

Name Type Description
serverid string Required. The id of the Server.
name string Required. The name of the System User. Length must be between 3 and 32 characters. Characters can be of lowercase ascii letters, digits, or a dash ('abcdefghijklmnopqrstuvwxyz0123456789-'), but must start with a lowercase ascii letter. user-32 is a valid name, while 3po is not.
password string The password of the System User. If user has no password, they will not be able to log in with a password. No leading or trailing whitespace is allowed and the password must be at least 8 and no more than 200 characters long.

When the request goes through successfully you should get this returned:

Update an existing system user

Parameters

Name Type Description
sysuserid string Required. The id of the System User.
password string The password of the System User. If user has no password, they will not be able to log in with a password. No leading or trailing whitespace is allowed and the password must be at least 8 and no more than 200 characters long.

Every parameter except for app id is optional (meaning that by providing null nothing will be changed).

Remove an existing system user

Apps

List all apps

Retrieve an existing app

Create a new app

Parameters

Name Type Description
name string Required. The nickname of the App. Length must be between 3 and 30 characters. Characters can be of lowercase ascii letters and digits.
sysuserid string Required. The System User that will "own" this App. Since every System User is specific to a Server, this implicitly determines on which Server the App will be created.
runtime string Required. The PHP runtime for an App. Choose from php5.4, php5.5, php5.6, php7.0, or php7.1.
domains array An array of domains that will be used in the webserver's configuration. If you set your app's domain name to example.com, Nginx and Apache will be configured to listen for both example.com and www.example.com. Note: The complete list of domains must be included in every update to this field.
wordpress array An array containing the following keys: site_title , admin_user , admin_password , and admin_email

When the request goes through successfully you should get this returned:

Update an existing app

Parameters

Name Type Description
runtime string The PHP runtime for an App. Choose from php5.4, php5.5, php5.6, php7.0, or php7.1.
domains array An array of domains that will be used in the webserver's configuration. If you set your app's domain name to example.com, Nginx and Apache will be configured to listen for both example.com and www.example.com. Note: The complete list of domains must be included in every update to this field.

Every parameter except for app id is optional (meaning that by providing null nothing will be changed).

Remove an existing app

Databases

List all databases

Retrieve an existing database

Create a new database

Parameters

Name Type Description
appid string Required. The id of the App.
name string Required. The name of the database. Length must be between 3 and 64 characters. Characters can be of lowercase ascii letters, digits, or a dash ('abcdefghijklmnopqrstuvwxyz0123456789-').
username string Required. The name of the Database User. Length must be at most 16 characters.
password string Required. The password of the Database User. No leading or trailing whitespace is allowed and the password must be at least 8 and no more than 200 characters long.

When the request goes through successfully you should get this returned:

Update an existing database

Parameters

Name Type Description
appid string Required. The id of the App.
userid string Required. The id of the Database User.
password string Required. The new password of the Database User. No leading or trailing whitespace is allowed and the password must be at least 8 and no more than 200 characters long.

Every parameter except for app id is optional (meaning that by providing null nothing will be changed).

Remove an existing database

SSL

Add custom SSL to an app

Parameters

Name Type Description
appid string Required. The id of the App.
key string Required. The contents of the private key.
cert string Required. The contents of the certificate.
cacerts string The contents of the CA certificate(s). If none, null is acceptable.

Remove custom SSL from an app

Enable AutoSSL for an app

AutoSSL can only be enabled when an AutoSSL certificate is available for an app.

Additionally, AutoSSL cannot be enabled when an app currently has a custom SSL certificate. To enable AutoSSL when an app is already using a custom SSL, first delete the app's custom SSL certificate.

Note that disabling AutoSSL is not done through this API call but instead is done by deleting SSL from the app.

Force SSL redirect for an app

orceSSL can only be enabled when an app already has SSL enabled.

You cannot enable ForceSSL at the same time as adding a custom SSL certificate or enabling AutoSSL.

Notes

ServerPilot site: https://serverpilot.io/

ServerPilot's API doc: https://github.com/ServerPilot/API

This project's Packagist link: https://packagist.org/packages/daverogers/serverpilot-php

Getting started with Composer: https://getcomposer.org/doc/00-intro.md

If this isn't your style, check out James West's PHP lib here: https://github.com/jameswestnz/ServerPilot-API-PHP-Wrapper


All versions of apiwrappers-serverpilot with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
ext-curl Version *
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package fernleafsystems/apiwrappers-serverpilot contains the following files

Loading the files please wait ....