1. Go to this page and download the library: Download manie20/dns library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
manie20 / dns example snippets
use Netcode\Dns\Modal\Zone;
use Netcode\Dns\Modal\Domain;
use Netcode\Dns\Modal\Email;
use Netcode\Dns\Modal\Records\SOA;
use Netcode\Dns\Modal\Records\A;
use Netcode\Dns\Modal\Records\CNAME;
use Netcode\Dns\Service\ZoneFileService;
$zone = new Zone();
$soaRecord = new SOA();
$soaRecord
->setName(
new Domain('netcode.nl')
)
->setEmailAddress(
new Email('[email protected]')
)
->setNameServer(
new Domain('ns')
)
->setSerialNumber(
$soaRecord->getNewSerial()
);
// Add the SOA Record to the newly created Zone.
$zone->setSoaRecord($soaRecord);
$aRecord = new A();
$aRecord->setContent('127.0.0.1');
$zone->addRecord($aRecord);
$aRecord = new A();
$aRecord
->setName('www')
->setContent('127.0.0.1')
->setTTL(300);
$zone->addRecord($aRecord);
$cnameRecord = new CNAME();
$cnameRecord
->setName('mail')
->setContent('www')
->setTTL(7200);
$zone->addRecord($cnameRecord);
// And add the MX record:
$mxRecord = new MX();
$mxRecord
->setContent('mail')
->setPriority('10')
->setTTL(7200);
$zone->addRecord($mxRecord);
$zoneFileService = new ZoneFileService();
$zoneFileService->getZoneText($zone)
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.