{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Configuration Options","description":"Developer documentation for the WHMCS API — the","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"configuration-options","__idx":0},"children":["Configuration Options"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["As with all modules in WHMCS, the configuration function is a required function of all registrar modules."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This defines the settings that are available for your registrar module. The name of this function must be ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["yourmodulename_getConfigArray"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The supported configuration field types include the following:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Text"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Password"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Yes/No Checkboxes"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Dropdown Menus"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Radio Buttons"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Text Areas"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Below are examples of the available parameters for each field type. Provisioning modules support up to 24 options defined in this way."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\nfunction yourmodulename_getConfigArray($params)\n{\n    return array(\n        \"username\" => array (\n            \"FriendlyName\" => \"UserName\",\n            \"Type\" => \"text\", # Text Box\n            \"Size\" => \"25\", # Defines the Field Width\n            \"Description\" => \"Textbox\",\n            \"Default\" => \"Example\",\n        ),\n        \"password\" => array (\n            \"FriendlyName\" => \"Password\",\n            \"Type\" => \"password\", # Password Field\n            \"Size\" => \"25\", # Defines the Field Width\n            \"Description\" => \"Password\",\n            \"Default\" => \"Example\",\n        ),\n        \"usessl\" => array (\n            \"FriendlyName\" => \"Enable SSL\",\n            \"Type\" => \"yesno\", # Yes/No Checkbox\n            \"Description\" => \"Tick to use secure connections\",\n        ),\n        \"package\" => array (\n            \"FriendlyName\" => \"Package Name\",\n            \"Type\" => \"dropdown\", # Dropdown Choice of Options\n            \"Options\" => \"Starter,Advanced,Ultimate\",\n            \"Description\" => \"Sample Dropdown\",\n            \"Default\" => \"Advanced\",\n        ),\n        \"disk\" => array (\n            \"FriendlyName\" => \"Disk Space\",\n            \"Type\" => \"radio\", # Radio Selection of Options\n            \"Options\" => \"100MB,200MB,300MB\",\n            \"Description\" => \"Radio Options Demo\",\n            \"Default\" => \"200MB\",\n        ),\n        \"comments\" => array (\n            \"FriendlyName\" => \"Notes\",\n            \"Type\" => \"textarea\", # Textarea\n            \"Rows\" => \"3\", # Number of Rows\n            \"Cols\" => \"50\", # Number of Columns\n            \"Description\" => \"Description goes here\",\n            \"Default\" => \"Enter notes here\",\n        ),\n    );\n}\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"configuration-validation","__idx":1},"children":["Configuration Validation"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When the configuration settings for your module are being saved, you may wish to validate them first before allowing them to be saved. You can define the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["_config_validate"]}," function in your module to do this."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This will allow you to run a block of code to determine if the details that the user has provided and is trying to save are valid or not. If there is a problem with validation, you can throw an exception to prevent the save action from completing."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The example code below demonstrates how to prevent saving the module configuration if an API responded with an error due to a parameter being invalid:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\n\nuse WHMCS\\Exception\\Module\\InvalidConfiguration;\n \nfunction yourmodulename_config_validate($params) {\n    $apiKey = $params['api_key'];\n  \n    $valid = false;\n    // $response = yourmodulename_apicall('validate_credentials', [\n    //     'apikey' => $apiKey,\n    // ]);\n    // $valid = $response['valid'];\n  \n    if (!$valid) {\n        throw new InvalidConfiguration('API Key is invalid.');\n    }\n}\n"},"children":[]}]},"headings":[{"value":"Configuration Options","id":"configuration-options","depth":1},{"value":"Configuration Validation","id":"configuration-validation","depth":2}],"frontmatter":{"title":"Configuration Options","seo":{"title":"Configuration Options"}},"lastModified":"2026-08-03T17:00:42.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/domain-registrars/config-options","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}