Creating Custom Modules
ModuleInterface, gateway, server, registrar modules
What it is
WHMDC supports custom modules for payment gateways, domain registrars, and server provisioning. All modules implement the ModuleInterface (documented below). Use these to integrate with external systems, build on top of WHMDC, or create modules for your own infrastructure.
ModuleInterface – required methods
interface ModuleInterface {
public function getName(): string; // e.g. "mygateway"
public function getType(): string; // "gateway"|"server"|"registrar"|"sms_provider"
public function getConfigFields(): array; // Admin config fields
public function initialize(array $config): bool;
public function execute($action, $params = []);
public function isEnabled(): bool;
public function getDisplayName(): ?string;
public function getConfigurableOptionKeys(): array; // Server modules
public function getConfigurableOptionDefaults(string $optionKey): array;
}
Module locations
| Type | Path |
|---|---|
| Gateway | modules/gateways/yourgateway/ |
| Registrar | modules/registrars/yourregistrar/ |
| Server | modules/servers/yourserver/ |
| SMS Provider | modules/sms_providers/yoursms/ |
| Addon | modules/addons/youraddon/ |
getConfigFields()
Return array of field definitions for Admin configuration:
[
['name' => 'api_key', 'label' => 'API Key', 'type' => 'text', 'required' => true],
['name' => 'test_mode', 'label' => 'Test Mode', 'type' => 'checkbox', 'required' => false]
]
Types: text, password, checkbox, textarea, select (with options array). See Minimal Module Examples for full config field reference.
execute() actions
Server: create, suspend, unsuspend, terminate, test_connection, list_packages.
Registrar: check_availability, register, renew, transfer, get_info, update_nameservers.
Gateway: Handled by PaymentManager; module provides capture, refund, etc.
SMS Provider: send (params: to, message). Return ["success" => true, "message_id" => "..."] or ["success" => false, "error" => "..."].
Return format
Always return array: ["success" => true, "data" => ...] or ["success" => false, "error" => "message"].
Further reading
See Minimal Module Examples for copy-paste starters, and Creating Server Modules / Creating Registrar Modules for detailed parameter documentation.
Was this helpful?