Home / Server and Provisioning Modules / Creating Server Modules

Creating Server Modules

cPanel, Plesk, custom

What it is

Server modules provision hosting accounts on cPanel, Plesk, DirectAdmin, Virtualizor, or custom panels. When an order is placed and paid, WHMDC calls your module to create the account on the server.

Directory structure

modules/servers/yourmodule/
├── module.json
├── YourModuleServer.php
└── logo.svg (optional)

module.json example

{
    "name": "yourmodule",
    "display_name": "Your Module",
    "description": "Integration for Your hosting panel",
    "version": "1.0.0",
    "author": "Your Company"
}

Required class methods

Implement ModuleInterface. Your class must define:

  • getName(), getType() (return "server")
  • getConfigFields() – fields for Admin when adding a server (hostname, username, API token, etc.)
  • initialize(array $config) – store config, validate credentials
  • execute($action, $params) – handle actions (see below)
  • isEnabled()

execute() actions

ActionPurpose
createCreate hosting account. Params: domain, username, password, package, etc.
suspendSuspend account
unsuspendUnsuspend account
terminateDelete account
test_connectionVerify API credentials work
list_packagesReturn available packages for dropdown
get_account_infoReturn account details (optional)

Return format

Always return an array: ["success" => true, "data" => ...] or ["success" => false, "error" => "message"].

Reference

See modules/servers/cpanel/ for a full cPanel/WHM implementation.

Was this helpful?

Tags: Developer