bennetgallein / bind-php-wrapper
There is no license information available for the latest version (v0.1) of this package.
A Wrapper to bind the PythonAPI to PHP
v0.1
2018-10-02 13:55 UTC
Requires
- php: >=7.2
- ext-curl: ^7.2
- ext-json: ^1.6
- myclabs/php-enum: ^1.6
- tracy/tracy: ^2.5
This package is auto-updated.
Last update: 2024-11-17 00:19:32 UTC
README
This a PHP Library to communincate with the Python REST API for BIND DNS-Server.
Installation
composer require bennetgallein/bind-php-wrapper
Getting started
This library requires the Python API to be setup up correctly and working. If that is the case, follow these Instructions:
create new BIND Instance:
$bind = new BIND("192.168.1.104", 5000, false);
Parameters:
- IP (no default)
- Port (default: 5000)
- HTTPS (default: false) Important: Only use http if you are in a safe local enviorment. Otherwise a Reverse Proxy is the way to go!
List all Records for a Zone:
$a = $bind->getZone("gallein2.de");
This returns a new Zone
Object:
$a->getDomain(); // returns the Domains name $a->getRecords(); // returns an array of Record-Objects
The Record
Object:
foreach ($a->getRecords() as $record) { echo $record->getName(); // The name, like '@', 'wwww', 'test', 'test2', ... echo $record->getAnswer(); // the response the DNS Server will give echo $record->getRecordType(); // the Record Type, like 'A', 'AAAA', 'MX', ... echo $record->getTTL(); // The TTL (Time To Live) of the Entry. }
Update/set a Record:
$res = $bind->addRecord("gallein2.de", "86400", "A", "192.168.1.1"); if ($res) { // yeah, success } else { // no success }
Delete a Record:
$res = bind->deleteRecord("gallein2.de", "86400", "A", "192.168.1.1"); if ($res) { // yeah, success } else { // no success }