A PHP library for interacting with the Spaceship API. This library provides a simple and intuitive way to manage domains, nameservers, contacts, and privacy settings.
composer require revoltify/spaceship-php
use Spaceship\SpaceshipAPI;
$api = new SpaceshipAPI('api_key', 'api_secret');
// Get domain information
$api->domain('example.com');
// Update nameservers
$params = NameserverParams::make()
->setProvider('custom')
->setHosts(['ns1.example.com', 'ns2.example.com']);
$api->updateNameserver('example.com', $params);
// Get domain auth code
$api->authCode('example.com');
// Update privacy protection
$params = PrivacyProtectionParams::make()
->setPrivacyLevel(PrivacyLevel::PUBLIC); // or PrivacyLevel::HIGH
$api->updatePrivacyProtection('example.com', $params);
// Lock domain transfer
$params = TransferLockParams::make()->lock();
// Unlock domain transfer
$params = TransferLockParams::make()->unlock();
$api->updateTransferLock('example.com', $params);
// Create new contact
$params = CreateContactParams::make()
->setFirstName('John')
->setLastName('Doe')
->setEmail('[email protected]')
->setAddress1('Dhaka')
->setCity('Dhaka')
->setCountryCode('BD')
->setPostalCode('1234')
->setPhone('+880.1333333333');
$api->createContact($params);
// Get contact information
$api->contact('5HebrteUuESDiv2TyC60yFpJw1oZ');
// Update contact
$params = UpdateContactParams::make()
->setRegistrant('1gFvGJ8mwW6t3lb2ovtUCP2YUDD')
->setAdmin('1gFvGJ8mwW6t3lb2ovtUCP2YUDD')
->setTech('1gFvGJ8mwW6t3lb2ovtUCP2YUDD')
->setBilling('1gFvGJ8mwW6t3lb2ovtUCP2YUDD');
$api->updateContact('example.com', $params);
- Basic Information:
name()
,unicodeName()
,isPremium()
,hasAutoRenew()
- Dates:
registrationDate()
,expirationDate()
,getDomainAge()
- Status:
verificationStatus()
,eppStatuses()
,isActive()
,isSuspended()
- Privacy:
privacyProtectionLevel()
,hasContactForm()
,hasHighPrivacy()
- Nameservers:
nameserverProvider()
,nameserverHosts()
- Contacts:
contacts()
,getContact()
,getRegistrantId()
- Expiration:
isExpired()
,daysUntilExpiration()
success()
,nameserverProvider()
,nameserverHosts()
success()
,authCode()
,expireDate()
success()
success()
success()
,contactId()
success()
,verificationStatus()
- Personal:
firstName()
,lastName()
,organization()
,email()
- Address:
address1()
,address2()
,city()
,state()
,countryCode()
,postalCode()
- Phone:
phone()
,phoneExt()
,fax()
,faxExt()
- Other:
taxNumber()
try {
$api = new SpaceshipAPI('api_key', 'api_secret');
} catch (SpaceshipException $e) {
// Handle error
}