{"id":21444993,"url":"https://github.com/ltd-beget/dns-zone-configurator","last_synced_at":"2025-06-22T18:08:15.203Z","repository":{"id":6739299,"uuid":"55444228","full_name":"LTD-Beget/dns-zone-configurator","owner":"LTD-Beget","description":"Php library for parsing and editing dns zones files programmatically with high level abstraction.","archived":false,"fork":false,"pushed_at":"2024-12-04T14:35:40.000Z","size":262,"stargazers_count":22,"open_issues_count":2,"forks_count":13,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-06-22T18:08:09.371Z","etag":null,"topics":["api"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LTD-Beget.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":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-04-04T20:53:07.000Z","updated_at":"2024-12-04T14:36:41.000Z","dependencies_parsed_at":"2024-12-04T15:36:29.623Z","dependency_job_id":null,"html_url":"https://github.com/LTD-Beget/dns-zone-configurator","commit_stats":{"total_commits":45,"total_committers":7,"mean_commits":6.428571428571429,"dds":"0.33333333333333337","last_synced_commit":"e52284eb624ae67a28aff4fdb19623b06e2ca3af"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"purl":"pkg:github/LTD-Beget/dns-zone-configurator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LTD-Beget%2Fdns-zone-configurator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LTD-Beget%2Fdns-zone-configurator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LTD-Beget%2Fdns-zone-configurator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LTD-Beget%2Fdns-zone-configurator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LTD-Beget","download_url":"https://codeload.github.com/LTD-Beget/dns-zone-configurator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LTD-Beget%2Fdns-zone-configurator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261338979,"owners_count":23143896,"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"],"created_at":"2024-11-23T02:22:30.865Z","updated_at":"2025-06-22T18:08:10.178Z","avatar_url":"https://github.com/LTD-Beget.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dns-zone-configurator\n\n[![Latest Stable Version](https://poser.pugx.org/ltd-beget/dns-zone-configurator/version)](https://packagist.org/packages/ltd-beget/dns-zone-configurator) \n[![Total Downloads](https://poser.pugx.org/ltd-beget/dns-zone-configurator/downloads)](https://packagist.org/packages/ltd-beget/dns-zone-configurator)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/LTD-Beget/dns-zone-configurator/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/LTD-Beget/dns-zone-configurator/?branch=master)\n[![Code Coverage](https://scrutinizer-ci.com/g/LTD-Beget/dns-zone-configurator/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/LTD-Beget/dns-zone-configurator/?branch=master)\n[![Build Status](https://scrutinizer-ci.com/g/LTD-Beget/dns-zone-configurator/badges/build.png?b=master)](https://scrutinizer-ci.com/g/LTD-Beget/dns-zone-configurator/build-status/master)\n[![Documentation](https://img.shields.io/badge/code-documented-brightgreen.svg)](http://ltd-beget.github.io/dns-zone-configurator/documentation/html/index.html)\n[![Documentation](https://img.shields.io/badge/code-coverage-brightgreen.svg)](http://ltd-beget.github.io/dns-zone-configurator/coverage/)\n[![License MIT](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://github.com/LTD-Beget/dns-zone-configurator/blob/master/LICENSE)\n\n\nPhp library for parsing and editing dns zones files programmatically with high level abstraction.\n\n## Installation\n\n```shell\ncomposer require ltd-beget/dns-zone-configurator\n```\n\n## Usage\n\n```php\n\u003c?php\n    use LTDBeget\\dns\\configurator\\Zone;\n    \n    require './vendor/autoload.php';\n    \n    // get you zone file content\n    $content = file_get_contents(__DIR__.\"/dns/zones/zone.conf\");\n    \n    // make zone object from plain content\n    $zone = Zone::fromString(\"voksiv.ru.\", $content);\n    \n    // iterate via nodes of zone, where Node is group of resource records with same name\n    foreach ($zone-\u003eiterateNodes() as $node) {\n        $node-\u003egetName();\n        $node-\u003egetZone();\n    }\n    \n    // or get concrete node\n    if($zone-\u003eisNodeExist(\"node.name\")) {\n        $node = $zone-\u003egetNode(\"node.name\");\n        $node-\u003egetName();\n        $node-\u003egetZone();\n    }\n    \n    // also you can iterate via resource records in zone\n    foreach ($zone-\u003eiterateRecords() as $record) {\n        $record-\u003egetType();\n        $record-\u003egetTtl();\n        $record-\u003egetNode();\n    }\n    // or iterate in node\n    if($zone-\u003eisNodeExist(\"node.name\")) {\n        $node = $zone-\u003egetNode(\"node.name\");\n        foreach ($node-\u003eiterateRecords() as $record) {\n            $record-\u003egetType();\n            $record-\u003egetTtl();\n            $record-\u003egetNode();\n        }\n    }\n    // or iterate only concrete records in zone or node\n    foreach ($zone-\u003eiterateA() as $record) {\n        $record-\u003egetAddress();\n        $record-\u003egetType();\n        $record-\u003egetTtl();\n        $record-\u003egetNode();\n    }\n    \n    // all records can be modified\n    foreach ($zone-\u003eiterateNs() as $record) {\n        $record-\u003esetNsdName(\"new.nsd.name.\");\n    }\n    \n    // or they can be deleted\n    foreach ($zone-\u003eiterateMx() as $record) {\n        $record-\u003eremove();\n    }\n    \n    // zone can be validate\n    if(! $zone-\u003evalidate()) {\n        // and if any errors, you can see them as array\n        $zone-\u003egetErrorsStore()-\u003etoArray();\n        // or can iterate via all, and remove invalid records for example\n        foreach ($zone-\u003egetErrorsStore()-\u003eiterate() as $error) {\n            if($error-\u003eisHasRecord()) {\n                $error-\u003egetRecord()-\u003eremove();\n            }\n        }\n    }\n    \n    // You can print zone as string, to put in in real zone file\n    $content = (string) $zone;\n    file_put_contents(__DIR__.\"/dns/zones/zone.conf\", $content);\n    \n    // Or you can store it in array format\n    $array_content = $zone-\u003etoArray();\n    \n    // and make zone again from array format\n    Zone::fromArray(\"voksiv.ru.\", $array_content);\n    \n    // also you can make zone programmatically\n    $zone = new Zone(\"voksiv.ru.\");\n    $node = $zone-\u003egetNode(\"@\");\n    $node-\u003egetRecordAppender()-\u003eappendARecord(\"127.0.0.1\");\n    $node-\u003egetRecordAppender()-\u003eappendNsRecord(\"google.com.\");\n```\n\n### Dns zone file tokenize only\nif you want only tokenize zone file you can use this [library](https://github.com/LTD-Beget/dns-zone-parser) \n\n\n### Developers\n\n## Regenerate documentation\n```shell\n$ ./vendor/bin/phpdox\n```\n\n### Run tests\n\n```shell\n$ php phpunit.phar --coverage-html coverage\n```\n\n## License\n\ndns-zone-configurator is released under the MIT License.\nSee the [bundled LICENSE file](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fltd-beget%2Fdns-zone-configurator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fltd-beget%2Fdns-zone-configurator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fltd-beget%2Fdns-zone-configurator/lists"}