Skip to content

southern-hu/kohana-powerdns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

kohana-powerdns

Kohana - PowerDNS Express API 2.3

PowerDNS API 2.3 library for Kohana 3.2 Framework. This module helps to manage domains and records hosted by PowerDNS Hosting solution. The modules has not been tested with earlier versions, but it may work with 3.0 and 3.1 versions. Will port for request.
To use this module you need to obtain an API key.
For more information, please visit: http://www.powerdns.net
PowerDNS API 2.3 documentation: PowerDNS Express API 2.3

Let's Start!

Enable Module

To use Kohana PowerDNS module:

  1. Download and extract the code from GitHub
  2. Place the extracted code into your Kohana application/modules/powerdns directory
  3. Enable the module within your application bootstrap, within the section entitled modules

Go to application/bootstrap.php, look for Kohana::modules() and append the following line to array:

'powerdns' => MODPATH.'powerdns', // PowerDNS

Configuration

Before you start to use this module, copy the modules/powerdns/classes/config/powerdns.php configuration file to under application/config/ directory and set a valid and working API key.

NOTE: In both following instantiate cases you can use the overload method to dynamically set the API key or the API URL. See example.

Instantiate Class


<?php defined('SYSPATH') or die('No direct script access.');  

class Controller_Welcome extends Controller {  
	public function action_index()  
	{  
		// Dynamic Way with overloading API key  
		$powerdns = new Kohana_PowerDNS("00000000-0000-0000-0000-000000000000");  
		$zones = $powerdns->listZones();  
	  
		// Static Way  
		$zones = PowerDNS::factory()->listZones();  
	}  
}  

Available methods

  • Add Native Domain

$response = PowerDNS::factory()->addNativeDomain("example.com");

  • Add Record to Zone

$response = PowerDNS::factory()->addRecordToZone(123456, "example.com", "mail.example.com", "MX", "127.0.0.1", "3600", 10);

  • List Zones

$response = PowerDNS::factory()->listZones();

  • List Records

$response = PowerDNS::factory()->listRecords(123456);

  • List Records by type

$response = PowerDNS::factory()->listRecordsByType(123456, "MX");

  • Delete All Records for Domain

$response = PowerDNS::factory()->deleteAllRecordsForDomain(123456);

  • Delete Record by Id

$response = PowerDNS::factory()->deleteRecordById(4567890);

  • Delete Zone by Id

$response = PowerDNS::factory()->deleteZoneById(123456);

  • Delete Zone by Name

$response = PowerDNS::factory()->deleteZoneByName("example.com");

  • Update Record

$response = PowerDNS::factory()->updateRecord(123456, "subdomain.example.com", "A", "192.168.0.1", 7200);

About

Kohana - PowerDNS API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages