splitice/rage4-api
Composer 安装命令:
composer require splitice/rage4-api
包简介
关键字:
README 文档
README
This is a PHP5 wrapper to easily integrate Rage4 DNS service (www.rage4.com). There is no official PHP SDK currently.
Number of API calls is not limited at the moment hence no mechanism added to track/limit the same.
The methods introduced in this first release are
- getDomains()
- getDomainByName()
- createDomain()
- createReverseDomain4()
- createReverseDomain6()
- deleteDomain()
- importDomain()
- getRecords()
- getGeoRegions()
- createRecord()
- updateRecord()
- deleteRecord()
You can also consult the official documentation available at the following URL: http://gbshouse.uservoice.com/knowledgebase/articles/109834-rage4-dns-developers-api
Official set of SDKs by Rage4: http://code.google.com/p/rage4-dns-sdk/ (only .NET available at the moment)
Requirements
You need PHP 5.3.2+ compiled with the cURL extension.
Install PHP Rage4 API
Installing via Composer
The recommended way to install OVH SDK is through Composer.
-
Add
splitice/rage4-apias a dependency in your project'scomposer.jsonfile:{ "require": { "splitice/rage4-api": "dev-master" } } -
Download and install Composer:
curl -s http://getcomposer.org/installer | php -
Install your dependencies:
php composer.phar install -
Require Composer's autoloader
Composer also prepares an autoload file that's capable of autoloading all of the classes in any of the libraries that it downloads. To use it, just add the following line to your code's bootstrap process:
require 'vendor/autoload.php';
You can find out more on how to install Composer, configure autoloading, and other best-practices for defining dependencies at getcomposer.org.
Examples
Here are some examples on how to do basic operations.
Configure the API client
using Splitice\Rage4\Rage4Api;
$r4 = new Rage4Api("username","password");
Get all domain names (zones)
$response = $r4->getDomains();
print_r($response);
Create a new domain name (zone)
// createDomain($domain_name, $email)
$response = $r4->createDomain('my-domain-name-here.com', 'you@yourhost.com');
print_r($response);
Create Reverse IPv4 domain
// createReverseDomain4($domain_name, $email, $subnet)
$response = $r4->createReverseDomain4('155.39.97.in-addr.arpa', 'you@yourhost.com', '27');
print_r($response);
Create Reverse IPv6 domain
// createReverseDomain6($domain_name, $email, $subnet)
$response = $r4->createReverseDomain6('0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa', 'you@yourhost.com', '48');
print_r($response);
Delete a new domain name (zone)
In this example, 627 is the ID of the domain zone to be deleted. To know the IDs of the domain zones, do $r4->getDomains(); first
// deleteDomain($domain_id)
$response = $r4->deleteDomain(627);
print_r($response);
Import a new domain name (zone)
Note! You need to allow AXFR transfers Note! Only regular domains are supported
// importDomain($domain)
$response = $r4->importDomain('my-domain-name-here.com');
print_r($response);
Get all records of a domain name (zone)
You need to mention the domain ID for which you need to get all records for. Again, if you are unsure please do a $r4->getDomains(); first
// getRecords($domain_id);
$response = $r4->getRecords(55);
print_r($response);
Create a new record for a particular domain name (zone)
// createRecord($domain_id, $name, $content, $type="TXT", $priority="", $failover="", $failovercontent="", $ttl=3600)
$response = $r4->createRecord(55, 'my-domain-name-here.com', 'ns1.4dns.com', "NS", 1500);
print_r($response);
Update an existing record
5555 is the record id that was returned from the function $r4->createRecord()
Note! No domain_name/domain_id is required while updating a record Note! There is no way to update the record-type at the moment, so the easy way is to delete the record first and then recreate with new values (if record-type is changed) e.g. from CNAME to TXT etc
// updateRecord($record_id, $name, $content, $priority="", $failover="", $failovercontent="", $ttl=3600)
$response = $r4->updateRecord(5555, 'my-domain-name-here.com', 'ns1.4dns.com', 1500);
print_r($response);
Delete an existing record
// deleteRecord($record_id)
$response = $r4->deleteRecord(5555);
print_r($response);
TODO / Wish List
- Monolog support
Credits
- Asim Zeeshan: The original class
- Piotr Ginalski from gbshouse.com for being very useful :)
splitice/rage4-api 适用场景与选型建议
splitice/rage4-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.04k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2014 年 06 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「Rage4」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 splitice/rage4-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 splitice/rage4-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 splitice/rage4-api 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
统计信息
- 总下载量: 5.04k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-06-04