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 credentialsexecute($action, $params)– handle actions (see below)isEnabled()
execute() actions
| Action | Purpose |
|---|---|
create | Create hosting account. Params: domain, username, password, package, etc. |
suspend | Suspend account |
unsuspend | Unsuspend account |
terminate | Delete account |
test_connection | Verify API credentials work |
list_packages | Return available packages for dropdown |
get_account_info | Return 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?