PHP code example of cyberfusion / powerdns

1. Go to this page and download the library: Download cyberfusion/powerdns 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/ */

    

cyberfusion / powerdns example snippets


use Cyberfusion\PowerDNS\PowerDNS;
use Cyberfusion\PowerDNS\Models\Zone;

$powerDns = new PowerDNS(host: 'server:port', apiKey: 'secret');

// Retrieve servers
$servers = $powerDns->servers()->list();

// Create a zone
$zone = $powerDns->zones()->create(
    serverId: $server[0]->getId(),
    zone: new Zone(name: 'cyberfusion.nl')
);

// Update a zone
$zone->setDnssec(true);
$success = $powerDns->zones()->updateZoneData($zone);