cwd / powerdns-client
0.3.5
2021-04-27 11:22 UTC
Requires
- php: >=7.1
- ext-json: *
- doctrine/annotations: ^1.6
- doctrine/cache: ^1.8
- php-http/discovery: ^1.0
- php-http/guzzle6-adapter: ^1.1
- symfony/http-foundation: >3.4.0
- symfony/serializer-pack: ~1.0
- symfony/validator: >3.4
- webmozart/assert: ~1.3
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.13
- phpunit/phpunit: ~7.4
- symfony/var-dumper: >3.4
Suggests
- symfony/symfony: For using bundle integration
This package is auto-updated.
Last update: 2024-12-09 15:45:27 UTC
README
Simple Usage:
$client = PowerDNSClientFactory::createClient('http://mydns.host.tld', 'YOUR_APIKEY_FROM_POWERDNS_CONFIG', 'localhost');
$servers = $client->servers()->all();
// Get all Zones:
$zones = $client->zones()->all();
// Create a new Zone:
$zone = (new Zone())
->setName('example.com.')
->setKind(Zone::KIND_MASTER)
->addRrset(
(new Zone\RRSet())->setName('www.example.com.')
->setType('A')
->setTtl(3600)
->addRecord(
(new Zone\Record())->setContent('127.0.0.1')
->setDisabled(false)
)
->addComment(
(new Zone\Comment())->setContent('Test Test')
->setAccount('Max Mustermann')
)
)
->addRrset((new Zone\RRSet())->setName('delete.example.com.')
->setType('A')
->setTtl(3600)
->addRecord(
(new Zone\Record())->setContent('127.0.0.1')
->setDisabled(false)
)
->addComment((new Zone\Comment())->setContent('test')->setAccount('Maxi'))
)
;
$zone = $client->zones()->create($zone);
Symfony Integration:
In bundles.php:
return [
// ....
Cwd\PowerDNSClient\CwdPowerDNSClient::class => ['all' => true],
];
add Basic Config:
cwd_power_dns_client:
uri: 'http://mydns.host.tld'
api_key: 'YOUR_APIKEY_FROM_POWERDNS_CONFIG'
default_server: 'localhost'
Usage:
// From the Container
$client = $ontainer->get(PowerDNSClient::class);
// or via autowiring
public function __construct(PowerDNSClient $client)
{
// ....
}