{"id":21300792,"url":"https://github.com/ente/technitium-dnsserver-php-api","last_synced_at":"2025-10-30T09:37:08.172Z","repository":{"id":257827583,"uuid":"871783536","full_name":"Ente/technitium-dnsserver-php-api","owner":"Ente","description":"API client to interact with the Technitium DNS Server","archived":false,"fork":false,"pushed_at":"2025-03-13T19:02:56.000Z","size":85,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-20T20:16:38.849Z","etag":null,"topics":["api","api-client","dns","php","php-api","php8","technitium-dns","technitium-dns-server"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ente.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-12T23:27:26.000Z","updated_at":"2025-03-13T19:01:55.000Z","dependencies_parsed_at":"2024-11-21T04:22:22.926Z","dependency_job_id":"0298538e-d00d-4bcc-87d3-dcce62af187e","html_url":"https://github.com/Ente/technitium-dnsserver-php-api","commit_stats":null,"previous_names":["ente/technitium-dnsserver-php-api"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/Ente/technitium-dnsserver-php-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ente%2Ftechnitium-dnsserver-php-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ente%2Ftechnitium-dnsserver-php-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ente%2Ftechnitium-dnsserver-php-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ente%2Ftechnitium-dnsserver-php-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ente","download_url":"https://codeload.github.com/Ente/technitium-dnsserver-php-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ente%2Ftechnitium-dnsserver-php-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264892058,"owners_count":23679214,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-client","dns","php","php-api","php8","technitium-dns","technitium-dns-server"],"created_at":"2024-11-21T15:31:17.655Z","updated_at":"2025-10-30T09:37:08.102Z","avatar_url":"https://github.com/Ente.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# technitium-dnsserver-php-api\n\nThis API client is intended to be used with Technitiums DNS Server\nFor the full Technitium API Documentation please visit [Technitium API Documentation](https://github.com/TechnitiumSoftware/DnsServer/blob/master/APIDOCS.md)\n\n## Installation\n\n### Via Git\n\nRun `git clone https://github.com/ente/technitium-dnsserver-php-api.git` where ever you want the library to be located.\n\nThen `require_once \"/path/to/API.dnsserver.ente.php\";` \u0026 `use Technitium\\DNSServer\\API\\API;` in your PHP file.\n\n### Via Composer\n\nRun `composer require ente/technitium-dnsserver-php-api`\n\nThen: `require_once \"/path/to/vendor/autoload.php\";` \u0026 `use Technitium\\DNSServer\\API\\API;`\n\n## Configuration\n\n### .env\n\n- `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`\n- `USERNAME`: The username for the user account. (You should create a dedicated one)\n- `PASSWORD`: The password for the user account.\n- `INCLUDE_INFO`: Returns basic information that might be relevant for the queried request.\n- `TOKEN`: Your API token, if already existent. (`[Your Username]` \u003e `[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`.\n- `USE_POST`: Specify if you want to access the API via POST (`true`) instead of GET (`false`) in default.\n- `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.\n\nWhen using `$api-\u003eadmin()-\u003elogs()-\u003eexport(\"2024-12-24\")` you may need to adjust the `memory_limit` in your `php.ini` file or via `ini_set()`.\n\n## General Usage\n\n```php\nrequire_once \"/vendor/autoload.php\";\nuse Technitium\\DNSServer\\API;\n\n$api = new API(\"path/to/env\", \"env-name\");\n\n// Get all zones\n$zones = $api-\u003ezones()-\u003eget();\n// Get all zone records\n$records = $api-\u003ezones()-\u003erecords()-\u003eget(\"example.com\");\n\n// Install an app\n\n$sampleApp = $api-\u003eapps()-\u003elistStoreApps()[\"storeApps\"][0];\nif($api-\u003eapps-\u003einstall($sampleApp[\"name\"])) {\n    echo \"App installed successfully!\";\n}\n\n// OR\n\n$sampleApp = $api-\u003eapps()-\u003elistStoreApps()[\"storeApps\"][0];\nif($api-\u003eapps-\u003edownloadAndInstall($sampleApp[\"name\"], $sampleApp[\"url\"])) {\n    echo \"App installed successfully!\";\n}\n\n```\n\n### Send to custom endpoint\n\n```php\n\u003c?php\n\nrequire_once \"/vendor/autoload.php\";\nuse Technitium\\DNSServer\\API;\n\n$api = new API(\"path/to/env\", \"env-name\");\n// You have to set \u003cbool\u003e$bypass to true to use this feature\necho var_dump($api-\u003esendCall(data: array(\"field\" =\u003e \"value\"), endpoint: \"admin/users/list\", skip: false, bypass: true))\n\n```\n\n## DDNS\n\nYou can use the `DDNS.Helper.API.dnsserver.ente.php` class to configure records to point to the current IP address.\n\n```php\n\u003c?php\n\nrequire_once \"/vendor/autoload.php\";\nuse Technitium\\DNSServer\\API;\nuse Technitium\\DNSServer\\API\\Helper\\DDNS;\n\n$path_to_configJSON = \"/my/config.json\";\n$ddns = new DDNS(new API());\n$ddns-\u003eupdateRecords($path_to_configJSON);\n\n// OR\n\n$ddns_result = new DDNS(new API(\"path/to/env\"), file_get_contents($path_to_configJSON)); // starts automatically updating the records\n\n// OR\n$api = new API();\n$ddns_result = $api-\u003eddns()-\u003eupdateRecords($path_to_configJSON);\n\n```\n\nYour DDNS configuration file should look like this:\n\n```json\n{\n    \"domanin\": \"example.com\",\n    \"records\": [\n        \"sub.example.com\"\n    ]\n}\n```\n\nYou can also set up multiple environments by using different configuration files:\n\n```php\n\u003c?php\n\nrequire_once \"/vendor/autoload.php\";\nuse Technitium\\DNSServer\\API;\nuse Technitium\\DNSServer\\API\\Helper\\DDNS;\n\nDDNS(new API(\"path/to/env\"), file_get_contents(\"/my/config.json\"));\nDDNS(new API(__DIR__), file_get_contents(\"/my/config2.json\"));\nDDNS(new API(__DIR__ . \"/configurations\", \".env-custom\"), file_get_contents(\"/my/config3.json\"));\n\n```\n\n## Changes\n\n### v1.2.1: Fixed and logs/export support\n\n- Added support for `logs/export` allowing you to export a DNS application log file\n- Fixed incorrect endpoint URL for some \"Log\" endpoints\n\n### v1.2: Adding support for export functions\n\n- Added support for export functions within API classes. When using export functions note that downloading log files may take quite a while. You may also need to adjust the `memory_limit`.\n\n\u003c!-- Added function to support downloading files --\u003e\n\u003c!-- Fixed incorrect endpoint URL for \"Log\" endpoints --\u003e\n\n### v1.1.4: Type safety\n\n- Added type safety to the `DDNS.Helper.API.dnsserver.ente.php` class\n- Added type safety to all other classes\n- Fixed incorrect/Added API docs\n\n### v1.1.3: Shell safe\n\n- Library is now shell safe (you are now required to specify the path to the `.env` file)\n- Silenced most $_SERVER['argv'] warnings when running the library in shell\n\n### v1.1.2: Quality\n\n- Added more documentation to the classes\n- Small code changes\n\u003c!-- Removed whitespaces --\u003e\n\n### v1.1.1: Fixes\n\n- Small changes to the `README.md`\n- Added code documentation within the classes\n- Implemented the `\u003cbool\u003e$bypass` parameter to the sendCall function to bypass the `prepareEndpoint` function therefore allowing to send to custom endpoints\n- Adjusted class functions scope\n\n### v1.1: Fixes\n\n- `TOKEN` can now be empty\n- Fixed some endpoints not working\n- Fixed issues preventing loading different environments\n- Exception handling\n\n### v1.0: Initial Release\n\n- initial release supporting each endpoint\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fente%2Ftechnitium-dnsserver-php-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fente%2Ftechnitium-dnsserver-php-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fente%2Ftechnitium-dnsserver-php-api/lists"}