承接 tafhyseni/godaddy-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

tafhyseni/godaddy-php

Composer 安装命令:

composer require tafhyseni/godaddy-php

包简介

A minimalist Godaddy Api Client for domain purchases and administrations

README 文档

README

A minimalist Godaddy PHP package for most of your operations with GoDaddy API..
PHP version Build Status Latest Stable Version License StyleCI

System Requirements

You need:

  • PHP >= 7.2 but the latest stable version of PHP is highly recommended
  • the intl extension

Installation

composer require tafhyseni/godaddy-php;

Usage

Before using GoDaddy PHP make sure you have already created a developer account at Godaddy Developer Portal.

Since this package uses php-domain-parser for validations and interactions with domain, make sure you enable ext-intl extension in your php.ini configuration.

use Tafhyseni\PhpGodaddy\Domain;
Domain::initialize('YOUR_API_KEY', 'YOUR_SECRET_KEY', 'PRODUCTION_MODE');

Methods

Check Domain Availability

Returns domain availability status, price to string, currency and period.

An example checking domain availability is as simple as it follows

try {
	$domain = Domain::initialize('YOUR_API_KEY', 'YOUR_SECRET_KEY', 'PRODUCTION_MODE');
	$mydomain = 'testingdomain.com';

	$check = $domain->available($domain);

	if($check->isAvailable())
	{
		// Domain is available
		$domainPrice = $this->priceToString();
	}else{
		// Domain is not available
	}
}

Available response properties and methods

Parameter / Method Data type Description
isAvailable() bool Returns domain availability status
priceToString() string Returns a response message containing: { price } { currency } / { period } year(s)
domain string Requested domain
availability integer Availability status
price float Domain price
currency string Currency in which price is listed
period integer Domain availability period

Multiple Domain Checks

A multiple availability check is covered aswell

$domain->availableMultiple([]);

Domain Suggestion

Returns a list of suggestions based in the keyword you specify.

$domain = Domain::initialize('YOUR_API_KEY', 'YOUR_SECRET_KEY', 'PRODUCTION_MODE');

$keyword = 'mybestdomain';

$suggestion = $domain->suggestion($keyword, 'LIMIT');
Request parameters Data type Default
keyword string -
limit integer 97
Response parameters Description
keyword Requested keyword
limit Requested limit
domains Array of returned domains

Domain Purchase

Purchase domain from Godaddy. First, set payment method for your account in Godaddy developer portal.

$domainName = 'mypurchasedomain.com';
$domain = Domain::initialize('YOUR_API_KEY', 'YOUR_SECRET_KEY', 'PRODUCTION_MODE');

$options = [
    'name'         => 'John',
    'surname'      => 'Doe',
    'email'        => 'john.doe@example.com',
    'phone'        => '+48.111111111',
    'organization' => 'Corporation Inc.',
    'street'       => 'Street Ave. 666',
    'city'         => 'New York City',
    'country'      => 'US',
    'postalCode'  => '91111',
    'state'        => 'New York'
];

try {
    $purchase = $domain->purchase($domainName, $options)
        ->nameServers([
            'dns.nameserver.com',
            'dns2.nameserver.com'
        ])->submit();
}catch(Exception $e) {
    // Catch Exception
}
Request parameters Data type Default
domain string -
options array -
nameServers() array -
period() integer 1
autorenew() bool true
Response paramters Data type Description
currency string Currency in which total is listed
itemCount integer Number of items included in the order
orderId integer Unique identifier of the order processed
total integer Total cost of the domain and any selection addons in micro unit

Changing DNS Records

$domainName = 'testinjoooo.biz'; // An already registered domain name under your account
$domain = Domain::initialize('YOUR_API_KEY', 'YOUR_SECRET_KEY', 'PRODUCTION_MODE');

$domain->records($domainName, 'RECORD_TYPE', [
	['name' => 'Point', 'data' => '123.1.1.1'],
	['name' => 'Point2', 'data' => '123.1.1.3'],
])->set();

Default API Return object

A general API response object is already declared and returns the following properties

property data type description
httpStatus integer Http response code
httpHeaders array Http headers
httpBody Object Method properties
httpMessage string Any available http message

Exceptions

We created custom responses which should be catched from your side. Therefor, using try/catch blocks is highly recommended.

Common Exception thrown

Code Name Message
401 noApiKeyProvided API Key has not been provided!
401 noSecretKeyProvided Secret Key has not been provided!
401 authorizationFailed Authorization failed. Check your secret/api keys.
400 noDomainProvided Domain name is required and cannot be empty!
422 noKeywordProvided No keyword has been specified!
400 invalidDomainPeriod Domain period should be within 1 and 10 range
404 domainNotAvailable Domain is not available for registration
403 invalidPaymentInfo Invalid payment information provided at your API account!
400 invalidRecordType Record type is invalid. Available types are: A, AAA, CNAME, MX, NS, SRV, TXT
404 recordDomainNotFound Given domain has not been found or is not registered

tafhyseni/godaddy-php 适用场景与选型建议

tafhyseni/godaddy-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.19k 次下载、GitHub Stars 达 17, 最近一次更新时间为 2020 年 06 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 tafhyseni/godaddy-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 tafhyseni/godaddy-php 我们能提供哪些服务?
定制开发 / 二次开发

基于 tafhyseni/godaddy-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 3.19k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 18
  • 点击次数: 7
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 17
  • Watchers: 1
  • Forks: 4
  • 开发语言: PHP

其他信息

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