ltd-beget/dns-zone-configurator
Composer 安装命令:
composer require ltd-beget/dns-zone-configurator
包简介
Php library for parsing and editing dns zones files programmatically with high level abstraction.
关键字:
README 文档
README
Php library for parsing and editing dns zones files programmatically with high level abstraction.
Installation
composer require ltd-beget/dns-zone-configurator
Usage
<?php use LTDBeget\dns\configurator\Zone; require './vendor/autoload.php'; // get you zone file content $content = file_get_contents(__DIR__."/dns/zones/zone.conf"); // make zone object from plain content $zone = Zone::fromString("voksiv.ru.", $content); // iterate via nodes of zone, where Node is group of resource records with same name foreach ($zone->iterateNodes() as $node) { $node->getName(); $node->getZone(); } // or get concrete node if($zone->isNodeExist("node.name")) { $node = $zone->getNode("node.name"); $node->getName(); $node->getZone(); } // also you can iterate via resource records in zone foreach ($zone->iterateRecords() as $record) { $record->getType(); $record->getTtl(); $record->getNode(); } // or iterate in node if($zone->isNodeExist("node.name")) { $node = $zone->getNode("node.name"); foreach ($node->iterateRecords() as $record) { $record->getType(); $record->getTtl(); $record->getNode(); } } // or iterate only concrete records in zone or node foreach ($zone->iterateA() as $record) { $record->getAddress(); $record->getType(); $record->getTtl(); $record->getNode(); } // all records can be modified foreach ($zone->iterateNs() as $record) { $record->setNsdName("new.nsd.name."); } // or they can be deleted foreach ($zone->iterateMx() as $record) { $record->remove(); } // zone can be validate if(! $zone->validate()) { // and if any errors, you can see them as array $zone->getErrorsStore()->toArray(); // or can iterate via all, and remove invalid records for example foreach ($zone->getErrorsStore()->iterate() as $error) { if($error->isHasRecord()) { $error->getRecord()->remove(); } } } // You can print zone as string, to put in in real zone file $content = (string) $zone; file_put_contents(__DIR__."/dns/zones/zone.conf", $content); // Or you can store it in array format $array_content = $zone->toArray(); // and make zone again from array format Zone::fromArray("voksiv.ru.", $array_content); // also you can make zone programmatically $zone = new Zone("voksiv.ru."); $node = $zone->getNode("@"); $node->getRecordAppender()->appendARecord("127.0.0.1"); $node->getRecordAppender()->appendNsRecord("google.com.");
Dns zone file tokenize only
if you want only tokenize zone file you can use this library
Developers
Regenerate documentation
$ ./vendor/bin/phpdox
Run tests
$ php phpunit.phar --coverage-html coverage
License
dns-zone-configurator is released under the MIT License. See the bundled LICENSE file for details.
ltd-beget/dns-zone-configurator 适用场景与选型建议
ltd-beget/dns-zone-configurator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 168.11k 次下载、GitHub Stars 达 22, 最近一次更新时间为 2016 年 04 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「dns」 「zone file」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ltd-beget/dns-zone-configurator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ltd-beget/dns-zone-configurator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ltd-beget/dns-zone-configurator 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Bundle for detecting the timezone
The file manager intended for using Laravel with CKEditor / TinyMCE / Colorbox
PHP API client for TimeZoneDB.com
Validates Zip/Postal Codes for any country and provides each country's localized name for their version of the Zip/Postal code (CEP, PLZ, PIN code, Eircode, NPA, CAP, ZIP code, etc.).
Ad library
Laravel Media Popup to upload/view the files
统计信息
- 总下载量: 168.11k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 23
- 点击次数: 39
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-04-12