PHPackages                             ente/technitium-dnsserver-php-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. ente/technitium-dnsserver-php-api

ActiveLibrary[API Development](/categories/api)

ente/technitium-dnsserver-php-api
=================================

API client to interact with the Technitium DNS Server

1.2.1(1y ago)521GPL-3.0-onlyPHPPHP &gt;=8.0

Since Oct 30Pushed 1y ago3 watchersCompare

[ Source](https://github.com/Ente/technitium-dnsserver-php-api)[ Packagist](https://packagist.org/packages/ente/technitium-dnsserver-php-api)[ RSS](/packages/ente-technitium-dnsserver-php-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (2)Versions (7)Used By (0)

technitium-dnsserver-php-api
============================

[](#technitium-dnsserver-php-api)

This API client is intended to be used with Technitiums DNS Server For the full Technitium API Documentation please visit [Technitium API Documentation](https://github.com/TechnitiumSoftware/DnsServer/blob/master/APIDOCS.md)

Installation
------------

[](#installation)

### Via Git

[](#via-git)

Run `git clone https://github.com/ente/technitium-dnsserver-php-api.git` where ever you want the library to be located.

Then `require_once "/path/to/API.dnsserver.ente.php";` &amp; `use Technitium\DNSServer\API\API;` in your PHP file.

### Via Composer

[](#via-composer)

Run `composer require ente/technitium-dnsserver-php-api`

Then: `require_once "/path/to/vendor/autoload.php";` &amp; `use Technitium\DNSServer\API\API;`

Configuration
-------------

[](#configuration)

### .env

[](#env)

- `API_URL`: The API URL of your Technitium DNS Server (with port), e.g. `localhost:5380`, `192.168.1.2:5380` or `server.domain.tld:5380`
- `USERNAME`: The username for the user account. (You should create a dedicated one)
- `PASSWORD`: The password for the user account.
- `INCLUDE_INFO`: Returns basic information that might be relevant for the queried request.
- `TOKEN`: Your API token, if already existent. (`[Your Username]` &gt; `[Create API Token]`). If left empty, the API will use the username and password for authentication to create an API token for you and will write it to your `.env`.
- `USE_POST`: Specify if you want to access the API via POST (`true`) instead of GET (`false`) in default.
- `USE_HTTPS`: Enable (`true`) HTTPS for the API connection. If your server does not support HTTPS, the API will simply return `false` to all requests.

When using `$api->admin()->logs()->export("2024-12-24")` you may need to adjust the `memory_limit` in your `php.ini` file or via `ini_set()`.

General Usage
-------------

[](#general-usage)

```
require_once "/vendor/autoload.php";
use Technitium\DNSServer\API;

$api = new API("path/to/env", "env-name");

// Get all zones
$zones = $api->zones()->get();
// Get all zone records
$records = $api->zones()->records()->get("example.com");

// Install an app

$sampleApp = $api->apps()->listStoreApps()["storeApps"][0];
if($api->apps->install($sampleApp["name"])) {
    echo "App installed successfully!";
}

// OR

$sampleApp = $api->apps()->listStoreApps()["storeApps"][0];
if($api->apps->downloadAndInstall($sampleApp["name"], $sampleApp["url"])) {
    echo "App installed successfully!";
}
```

### Send to custom endpoint

[](#send-to-custom-endpoint)

```
