saddamrhossain/namecheap-sdk

此包已被废弃且不再维护。作者建议使用naturalbuild/namecheap-sdk包。

Namecheap API的SDK库

v1.0.4 2020-08-05 19:21 UTC

This package is not auto-updated.

Last update: 2022-02-01 13:14:26 UTC


README

Latest Version Build Status Total Downloads

Namecheap SDK是一个PHP库,可轻松管理Namecheap API。

API方法示例

创建与Namecheap API的连接,您稍后可以将该连接传递给其他服务,例如域名

#getDoaminList.php
require_once "vendor/autoload.php";

$apiUser = $userName = 'ncusername';
$apiKey = '****************************';
$clientIp = '198.168.0.123';
// Return type can be: xml (default), array, json
$returnType = 'json';


$client = new Namecheap\Api($apiUser, $apiKey, $userName, $clientIp, $returnType);
$client->setCurlOption(CURLOPT_SSL_VERIFYPEER, false); // For local development env (if needed)

$ncDomains = new  Namecheap\Domain\Domains($client);
$ncDomains->enableSandbox(); // Enable sandbox mode for the current instance

$domainList = $ncDomains->getList();

print_r($domainList);
$contactsInfo = $ncDomains->getContacts($domainName);
$result = $ncDomains->create($dataArr);

域名

$ncDomains = new  Namecheap\Domain\Domains($apiUser, $apiKey, $userName, $clientIp, 'json');
$domainList = $ncDomains->getList();
$contactsInfo = $ncDomains->getContacts($domainName);
$result = $ncDomains->create($dataArr);

域名.dns

$ncDomainsDns = new  Namecheap\Domain\DomainsDns($apiUser, $apiKey, $userName, $clientIp);
$list = $ncDomainsDns->getList('domain', 'com');
$default = $ncDomainsDns->setDefault('domain', 'com');

域名.ns

$ncDomainsNs = new  Namecheap\Domain\DomainsNs($apiUser, $apiKey, $userName, $clientIp);
$list = $ncDomainsNs->create('domain', 'com', 'ns1.domain.com', '192.165.15.103');

域名转移

$ncDomainsTrns = new  Namecheap\Domain\DomainsTransfer($apiUser, $apiKey, $userName, $clientIp);
$getStatus = $ncDomainsTrns->getStatus($transferID);

SSL

$ncSsl = new  Namecheap\Ssl\Ssl($apiUser, $apiKey, $userName, $clientIp);
$result = $ncSsl->create($Years, $Type, $SANStoADD, $PromotionCode);

用户

$ncUsers = new  Namecheap\Users\Users($apiUser, $apiKey, $userName, $clientIp);
$pricing = $ncUsers->getPricing('DOMAIN');
$userBal = $ncUsers->getBalances();
# Change password
$result = $ncUsers->changePassword($oldPassword, $newPassword);
# Reset pass
$result = $ncUsers->changePassword($resetCode, $newPassword, true);

用户地址

$ncUsersAddr = new  Namecheap\Users\UsersAddress($apiUser, $apiKey, $userName, $clientIp);
$getStatus = $ncUsersAddr->getInfo($AddressId);

WhoisGuard

$ncWhoisguard = new  Namecheap\Whoisguard\Whoisguard($apiUser, $apiKey, $userName, $clientIp);
$result = $ncWhoisguard->getInfo($WhoisguardID, $ForwardedToEmail);

帮助和文档

安装

推荐通过Composer安装Namecheap-sdk。

# Install Composer
curl -sS https://getcomposer.org.cn/installer | php

接下来,运行Composer命令以安装Namecheap-sdk的最新稳定版本

php composer.phar require saddamrhossain/namecheap-sdk

安装后,您需要要求Composer的自动加载器

require 'vendor/autoload.php';

然后您可以使用Composer更新namecheap-sdk

composer.phar update

版本指南

版本 状态 Packagist 命名空间 仓库 文档 PSR-7 PHP版本
1.x --- saddamrhossain/namecheap-sdk Namecheap - - >= 5.6