servebolt / namecheap-sdk
SDK library for Namecheap APIs
Installs: 1 846
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^7.4|^8
- ext-curl: *
- ext-dom: *
- ext-json: *
- ext-simplexml: *
This package is auto-updated.
Last update: 2024-11-24 11:03:09 UTC
README
Namecheap SDK is a PHP lib that makes it easy to manage Namecheap APIs.
Fork of the original project:
Installing
The recommended way to install Namecheap-sdk is through Composer.
composer require servebolt/namecheap-sdk
API Methods Examples:
Create a connection to the Namecheap API which you can then pass into other services, e.g. domains, later on
#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);
domains
$ncDomains = new Namecheap\Domain\Domains($apiUser, $apiKey, $userName, $clientIp, 'json'); $domainList = $ncDomains->getList(); $contactsInfo = $ncDomains->getContacts($domainName); $result = $ncDomains->create($dataArr);
domains.dns
$ncDomainsDns = new Namecheap\Domain\DomainsDns($apiUser, $apiKey, $userName, $clientIp); $list = $ncDomainsDns->getList('domain', 'com'); $default = $ncDomainsDns->setDefault('domain', 'com');
domains.ns
$ncDomainsNs = new Namecheap\Domain\DomainsNs($apiUser, $apiKey, $userName, $clientIp); $list = $ncDomainsNs->create('domain', 'com', 'ns1.domain.com', '192.165.15.103');
domains.transfer
$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);
users
$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);
users.address
$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);