# Create zone

## createZone()

Gets executed by hostware **before** the transfer / registration gets executed. After that, hostware waits 5 minutes to execute the trans/reg operation so the zone can be reached globally.

{% hint style="info" %}
**This function is optional**\
If not implemented, hostware will expect that the zone will be created during transfer / registration.
{% endhint %}

### Parameters

You get both the TLD and SLD of the requested domain. If the customer searches for "hostware.io", you get the following input:

<table><thead><tr><th width="142">Type</th><th width="166">Name</th><th>Description</th></tr></thead><tbody><tr><td>Domain</td><td>$domain</td><td>The Domain model</td></tr><tr><td>Array</td><td>$nameservers</td><td>Array of nameservers</td></tr></tbody></table>

### Response

Optionally a mixed response which will be interpreted and saved as the zone id.

### Example Code

```php
	public function createZone(Domain $domain, array $nameservers) {

		$xml = <<<XML
<?xml version="1.0" encoding="utf-8" ?>
<request>
	{$this->getXmlHeader()}
    <transaction>
		<group>dns</group>
		<action>create</action>
		<attribute>managed</attribute>
		<object>{$domain->punycode_fqdn}</object>
		<values>
			{$this->_getZoneXml($domain)}
		</values>
	</transaction>
</request>
XML;

		$this->getClient()->callRaw($xml, $this->config['sandbox']);
	}
```
