cyberfusion / powerdns
Easy-to-use PHP client for the PowerDNS API.
v2.3.0
2024-08-14 11:51 UTC
Requires
- php: ^8.3
- guzzlehttp/guzzle: ^7.5
- illuminate/http: ^10.0|^11.0
- illuminate/support: ^10.0|^11.0
Requires (Dev)
- phpstan/phpstan: ^1.9
- phpunit/phpunit: ^10.0|^11.0
- symplify/easy-coding-standard: ^12.0
README
Easy-to-use PHP client for the PowerDNS API.
PowerDNS API documentation: https://doc.powerdns.com/authoritative/http-api/index.html
Install
Composer
Run the following command to install the package from Packagist:
composer require cyberfusion/powerdns
Usage
Example
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);
Handling failed response
When a request fails, a Illuminate\Http\Client\RequestException
is thrown.