A complete boilerplate/template for building WHMCS provisioning modules. This project provides a working example with Docker-based local development environment.
- Complete Module Structure: Full provisioning module with all required functions
- API Integration Template: Ready-to-use API helper class
- Docker Development Environment: Local WHMCS testing setup
- Hook Examples: Common WHMCS hooks implemented
- Best Practices: Follows WHMCS module development guidelines
- WHMCS 8.0+
- PHP 7.3+
- Docker & Docker Compose (for local development)
- cURL extension enabled
Copy the module to your WHMCS installation:
cp -r whmcs/modules/servers/demo /path/to/whmcs/modules/servers/
cp -r whmcs/includes/hooks/* /path/to/whmcs/includes/hooks/- Go to Setup → Products/Services → Servers
- Click Add New Server
- Configure:
- Name: Demo Service
- Hostname: Your API endpoint URL
- Type: Demo Module
- Password: Your API Key
- Go to Setup → Products/Services → Products/Services
- Create a new product with:
- Module: Demo Module
- Server Group: Your server group
- Create a test order for a customer
- Accept the order and run Create from the service
- Verify the service shows "Active" status
whmc-modile/
├── whmcs/ # WHMCS module files
│ ├── modules/servers/ # Provisioning module
│ │ └── demo/ # Demo module
│ └── includes/hooks/ # Hook examples
├── scripts/ # Setup & utility scripts
├── tests/ # Test files
└── docs/ # Documentation
Set up a local WHMCS environment with Docker:
# 1. Run the environment setup script
chmod +x scripts/setup-local.sh
./scripts/setup-local.sh
# 2. Start the Docker containers
docker compose up -d
# 3. Configure the module (creates server, product, test client)
chmod +x scripts/setup-module.sh
./scripts/setup-module.sh| Resource | URL |
|---|---|
| WHMCS Client Area | http://localhost:8088/ |
| WHMCS Admin | http://localhost:8088/admin/ |
| phpMyAdmin | http://localhost:8081/ |
| MailHog | http://localhost:8025/ |
| Service | Username | Password |
|---|---|---|
| WHMCS Admin | admin | password |
| MySQL | whmcs | password |
| MySQL Root | root | password |
The demo module implements all standard WHMCS provisioning functions:
| Function | Description |
|---|---|
CreateAccount |
Provision a new service |
SuspendAccount |
Suspend a service |
UnsuspendAccount |
Reactivate a suspended service |
TerminateAccount |
Permanently remove a service |
TestConnection |
Test API connectivity |
Replace demo with your module name:
# Rename folder
mv whmcs/modules/servers/demo whmcs/modules/servers/yourmodule
# Update function prefixes in yourmodule.php
# Change: demo_MetaData, demo_CreateAccount, etc.
# To: yourmodule_MetaData, yourmodule_CreateAccount, etc.Edit the ApiHelper class in your module:
$this->apiEndpoint = 'https://your-api.com/v1';Define product-specific options in ConfigOptions():
function yourmodule_ConfigOptions(): array
{
return [
'plan' => [
'FriendlyName' => 'Plan Type',
'Type' => 'dropdown',
'Options' => ['basic' => 'Basic', 'pro' => 'Pro'],
],
];
}- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
MIT License - feel free to use this as a starting point for your own modules.
For WHMCS documentation, visit: https://developers.whmcs.com/