tafhyseni / godaddy-php
A minimalist Godaddy Api Client for domain purchases and administrations
Installs: 3 163
Dependents: 0
Suggesters: 0
Security: 0
Stars: 18
Watchers: 1
Forks: 4
Open Issues: 0
Requires
- php: ^7.2.5|^8.0
- ext-intl: *
- guzzlehttp/guzzle: >=6.5
- jeremykendall/php-domain-parser: ^5.6
Requires (Dev)
- phpunit/phpunit: ^8.0.0
This package is auto-updated.
Last update: 2024-10-27 18:39:27 UTC
README
A minimalist Godaddy PHP package for most of your operations with GoDaddy API..
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 yourphp.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
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');
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 }
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
Exceptions
We created custom responses which should be catched from your side. Therefor, using try/catch blocks is highly recommended.
Common Exception thrown