- Notifications
You must be signed in to change notification settings - Fork0
A simple PHP class for generating DNS zone files
License
NotificationsYou must be signed in to change notification settings
evan-klein/zone-file
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A simple PHP class for generating DNSzone files.
- SupportsA,AAAA,CNAME,TXT,MX,SRV, andNS records
- Compatible with:
- Shell script to deploy to Route 53
- RFC 1035/RFC 1034 compliant-ish
<?phprequire('ZoneFile.php');$zone_file =new \evan_klein\zone_file\ZoneFile('example.com.',180);$zone_file->addA('www','93.184.216.34',120);$zone_file->addAAAA('www','2606:2800:220:1:248:1893:25c8:1946',120);echo$zone_file->output();?>
The code above generates the output below:
$ORIGIN example.com.$TTL 180;example.com.www 120 IN A 93.184.216.34www 120 IN AAAA 2606:2800:220:1:248:1893:25c8:1946
You can also chain commands like this:
<?phprequire('ZoneFile.php');$zone_file =new \evan_klein\zone_file\ZoneFile('example.com.',180);echo$zone_file->addA('www','93.184.216.34',120)->addAAAA('www','2606:2800:220:1:248:1893:25c8:1946',120)->output();?>