定制 rahulmukati/hetzner-dns 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

rahulmukati/hetzner-dns

Composer 安装命令:

composer require rahulmukati/hetzner-dns

包简介

All new and simple Hetzner DNS library for PHP.

README 文档

README

Hetzner DNS

All new and simple Hetzner DNS library for PHP.

Features

  • Lightweight - Less than 5 KB, portable with only one file

  • Easy - Extremely easy to learn and use, friendly construction

  • Powerful - Supports almost all Hetzner DNS features

  • Friendly - Works well with every PHP frameworks, like Laravel, Codeigniter, Yii, Slim, and framework which supports singleton extension or composer

  • Free - Under MIT license, you can use it anywhere whatever you want

Requirement

PHP 5.6+, recommend PHP 7.0+

Get Started

Install via composer

Add to composer.json configuration file.

$ composer require rahulmukati/hetzner-dns

And update the composer

$ composer update
// If you installed via composer, just use this code to require autoloader on the top of your projects.
require 'vendor/autoload.php';

// Using HetznerDNS namespace
use HetznerDNS\HetznerDNS;

// Initialize
$hdns = new HetznerDNS([
  'api_token' => 'YOURAPITOKENHERE'
]);

Create DNS Zone

$hdns->createZone([
  'name' => 'example.com', //Required: String
  'ttl' => '3600' //Optional: Integer
]);

Import DNS Zone file

$body = '$ORIGIN example.com.
$TTL 3600
; SOA Records
@		IN	SOA	ns1.yourdomain.com. dns.yourdomain.com. 2020081403 86400 10800 3600000 3600
; NS Records
@		IN	NS	ns1.yourdomain.com.
@		IN	NS	ns2.yourdomain.com.
; A Records
@		IN	A	192.168.1.1
; CNAME Records
www		IN	CNAME	example.com.';

$hdns->importZoneFile('ZoneIDHere', $body);

Export DNS Zone file

$hdns->exportZoneFile('ZoneIDHere');

Get all DNS Zones

$hdns->getZones([
  'name' => '', //Optional: String
  'page' => '', //Optional: Number >= 1
  'per_page' => '', //Optional: Number <= 100
  'search_name' => '', //Optional: String
]);

Get single DNS Zone

$hdns->getZone('ZoneIDHere');

Update DNS Zone

$hdns->updateZone('ZoneIDHere', [
  'name' => 'example.com', //Required: String
  'ttl' => '3600' //Optional: Integer
]);

Delete DNS Zone

$hdns->deleteZone('ZoneIDHere');

Create DNS Record

$hdns->createRecord([
  'zone_id' => 'ZoneIDHere', //Required: String
  'name' => '@', //Required: String
  'type' => 'CNAME', //Required: String ("A" "AAAA" "NS" "MX" "CNAME" "RP" "TXT" "SOA" "HINFO" "SRV" "DANE" "TLSA" "DS" "CAA")
  'value' => 'example.com', //Required
  'ttl' => '3600' //Optional: Integer
]);

Get all DNS Records

$hdns->getRecords([
  'zone_id' => 'ZoneIDHere', //Optional: String
  'page' => '1', //Optional: Number
  'per_page' => '10', //Optional: Number
]);

Get single DNS Record

$hdns->getRecord('RecordIDHere');

Update DNS Record

$hdns->updateRecord('RecordIDHere', [
  'zone_id' => 'ZoneIDHere', //Required: String (ID of zone this record is associated with)
  'name' => '@', //Required: String
  'type' => 'CNAME', //Required: String ("A" "AAAA" "NS" "MX" "CNAME" "RP" "TXT" "SOA" "HINFO" "SRV" "DANE" "TLSA" "DS" "CAA")
  'value' => 'example.com', //Required
  'ttl' => '3600' //Optional: Integer
]);

Delete DNS Record

$hdns->deleteRecord('RecordIDHere');

统计信息

  • 总下载量: 379
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-08-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固