PHPackages                             adzon/namesilo-composer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. adzon/namesilo-composer

ActiveLibrary[API Development](/categories/api)

adzon/namesilo-composer
=======================

Use Namesilo Api In Laravel

4161PHP

Since Dec 17Pushed 6y ago1 watchersCompare

[ Source](https://github.com/adzon/namesilo-composer)[ Packagist](https://packagist.org/packages/adzon/namesilo-composer)[ RSS](/packages/adzon-namesilo-composer/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

namesilo-composer
=================

[](#namesilo-composer)

Use Namesilo Api In Laravel

Simple PHP SDK for registering domain names using Namesilo.com.

### Dependencies

[](#dependencies)

- php-xml package.

Install in Debian:

```
sudo aptitude install php7.0-xml

```

### Quick start

[](#quick-start)

Create an instance of the Namesilo class.

> To receive a sandbox API key for testing, please contact namesilo.

```
#### create a Namesilo object with production key
$ns = new Namesilo('your api key');

#### create a Namesilo object with sandox key
$ns = new Namesilo('your api key',true);

#### turn Debugging on (if you want to fix an issue with this library)
$ns = new Namesilo('your api key',true,true);

#### Simple usage
try{
    $ns->is_domain_available('example.com');
}catch(Exception $e){
    #### print error message
    echo $e->getMessage();
}
```

### Debugging

[](#debugging)

To enable debugging edit namesilo.php provide a third argument to Namesilo() and set it to `tre`.

```
$ns = new Namesilo('your api key',true,true);
```

Once enabled, all functions (methods) `print_r()` their request and return value.

> never turn debugging on in production.

### Usage example

[](#usage-example)

Retrieve the lock status for exmaple.com

```
try{
    $lock_status = $ns->lock_status('example.com');
}catch(Exception $e){
    echo $e->getMessage();
}
if($lock_status){
    echo 'domain is lock';
}else{
    echo 'domain is unlock';
}
```

### List of methods

[](#list-of-methods)

> NOTE: make sure that you capture possible errors with a `try {} catch {}` as shown in the above examples.

- [create\_contact()](#create_contact): create a new contact id. Used for new domain registration.
- [delete\_contact()](#delete_contact): useful for deleting a contact if registration fails
- [register\_domain\_by\_contact\_id()](#register_domain_by_contact_id)
- [register\_domain()](#register_domain): create a new contact id and register domain at once (not recommended)
- [update\_nameservers()](#update_nameservers)
- [update\_contact\_by\_domain()](#update_contact_by_domain)
- [add\_dns\_record()](#add_dns_record)
- [get\_dns\_records()](#get_dns_records): returns an array of dns records
- [delete\_dns\_record()](#delete_dns_record)
- [is\_domain\_available()](#is_domain_available)
- [send\_auth\_code()](#send_auth_code): Have the EPP transfer code for the domain emailed to the administrative contact.
- [get\_contact\_by\_id()](#get_contact_by_id)
- [list\_domains()](#list_domains)
- [get\_nameservers()](#get_nameservers)
- [privacy\_status()](#privacy_status)
- [add\_privacy()](#add_privacy)
- [remove\_privacy()](#remove_privacy)
- [get\_domain\_info()](#get_domain_info)
- [get\_account\_balance()](#get_account_balance)

### create\_contact()

[](#create_contact)

Use this function to create a new contact-id and then use the contact-id retuned by this function to associate it with a new domain registration.

> returns created contact id on success and false on failure.

```
$contact_id = $ns->create_contact(
      $fn, // first name
      $ln, // last name
      $ad, // address
      $cy, // city
      $st, // state
      $zp, // zip
      $ct, // country
      $em, // email
      $ph  // phone
);
```

### register\_domain\_by\_contact\_id()

[](#register_domain_by_contact_id)

> returns true on success and false on failure.

```
$result = $ns->register_domain_by_contact_id($domain,$contact_id,$years=1);
```

> This function will automatically attemp to delete the contact if registration fails.

> Default profile and profiles that are associated with any active domains cannot be deleted.

### register\_domain()

[](#register_domain)

Create a new contact-id and register a domain for it at once. This method is not recommended.

> returns true on success and false on failure.

```
$ns->register_domain(
      $domain, // example.com
      $fn, // first name
      $ln, // last name
      $ad, // address
      $cy, // city
      $st, // state
      $zp, // zip
      $ct, // country
      $em, // email
      $ph,  // phone
      $years = 1
);
```

### update\_contact\_by\_domain()

[](#update_contact_by_domain)

> returns true on success and false on failure.

```
$contact_id = $ns->update_contact_by_domain(
      $domain, // example.com
      $fn, // first name
      $ln, // last name
      $ad, // address
      $cy, // city
      $st, // state
      $zp, // zip
      $ct, // country
      $em, // email
      $ph  // phone
);
```

### update\_nameservers()

[](#update_nameservers)

Change the NameServers associated with one of your domains.

> returns true on success and false on success and false on failure.

```
$result = $ns->update_nameservers('example.com','ns1.namesilo.com','ns2.namesilo.com');
```

### delete\_contact()

[](#delete_contact)

> returns true on success and false on failure.

```
$ns->delete_contact($contact_id);
```

> Please remember that the only contact profiles that can be deleted are those that are not the account default and are not associated with any active domains or order profiles.

### add\_dns\_record()

[](#add_dns_record)

> returns true on success and false on failure.

```
$ns->add_dns_record($domain,$type,$host,$value,$distance='',$ttl='');
```

> $type possible values are "A", "AAAA", "CNAME", "MX" and "TXT"

> $host The hostname for the new record (there is no need to include the ".DOMAIN")

> $value - A - The IPV4 Address
> - AAAA - The IPV6 Address
> - CNAME - The Target Hostname
> - MX - The Target Hostname
> - TXT - The Text

> $distance: Only used for MX (default is 10 if not provided)

> $ttl: The TTL for the new record (default is 7207 if not provided)

### get\_dns\_records()

[](#get_dns_records)

> returns an array of records on success and false on failure.

```
$ns->get_dns_records($domain);
```

Sample `print_r()` of successfull return value:

> Again, make sure you capture exceptions.

```
Array
(
    [0] => Array
        (
            [record_id] => a8c4251d3c3d114d70d48dcaf0288257
            [type] => A
            [host] => sunsed-test15.com
            [value] => 173.255.255.106
            [ttl] => 7200
            [distance] => 0
        )

)

```

### delete\_dns\_record()

[](#delete_dns_record)

> returns true on success and false on failure.

```
$ns->delete_dns_record($domain,$record_id);
```

### is\_domain\_available()

[](#is_domain_available)

> possible return values: 'available', 'invalid', 'unavailable' and false.

```
try{
    $result = $ns->is_domain_available($domain);
    if($result == 'available'){
        echo 'domain is available';
    }elseif($result == 'invalid'){
        echo 'pleas check your domain';
    }elseif($result == 'unavailable'){
        echo 'domain is not available';
    }else{
        echo 'failed';
    }
}catch(Exception $e){
    echo $e->getMessage();
}
```

### send\_auth\_code()

[](#send_auth_code)

> returns true on success and false on failure.

```
ns->send_auth_code($domain);
```

### get\_contact\_by\_id()

[](#get_contact_by_id)

> returns contact info on success and false on failure.

```
$ns->get_contact_by_id($contact_id);
```

### list\_domains()

[](#list_domains)

> returns an array of domains on success and false on failure.

```
try{
    $result = $ns->list_domains();
    if($result){
        echo 'success';
    }else{
        echo 'failed';
    }
}catch(Exception $e){
    echo $e->getMessage();
}
```

Sample return value:

```
Array
(
    [0] => sunsed-test12.com
    [1] => sunsed-test13.com
    [2] => sunsed-test15.com
)

```

### get\_nameservers()

[](#get_nameservers)

> returns an array of nameservers on success and false on failure.

Sample return value:

```
Array
(
    [0] => NS1.NAMESILO.COM
    [1] => NS2.NAMESILO.COM
)

```

> Note: Namesilo returns the namesevrers in capital letters.

### privacy\_status()

[](#privacy_status)

Retrieves the privacy status.

```
$result = $ns->privacy_status($domain);
if($result)
    echo 'Privacy is enabled';
else
    echo 'Privacy is disabled';
```

### add\_privacy()

[](#add_privacy)

```
$result = $ns->add_privacy($domain);
```

### remove\_privacy()

[](#remove_privacy)

```
$result = $ns->remove_privacy($domain);
```

### get\_domain\_info()

[](#get_domain_info)

> returns domain-info-array on success and false on failure.

```
$ns->get_domain_info($domain);
```

Sample return value:

```
Array
(
    [code] => 300
    [detail] => success
    [created] => 2015-02-06
    [expires] => 2016-02-06
    [status] => Active
    [locked] => Yes
    [private] => Yes
    [auto_renew] => No
    [traffic_type] => Custom DNS
    [forward_url] => N/A
    [forward_type] => N/A
    [nameservers] => Array
        (
            [nameserver] => Array
                (
                    [0] => NS1.NAMESILO.COM
                    [1] => NS2.NAMESILO.COM
                )

        )

    [contact_ids] => Array
        (
            [registrant] => 903
            [administrative] => 903
            [technical] => 903
            [billing] => 903
        )

)

```

### get\_account\_balance()

[](#get_account_balance)

> returns account balance on success and false on failure.

```
$result = $ns->get_account_balance();
```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 50% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9563632?v=4)[A.](/maintainers/adzon)[@adzon](https://github.com/adzon)

---

Top Contributors

[![adzon](https://avatars.githubusercontent.com/u/9563632?v=4)](https://github.com/adzon "adzon (2 commits)")[![affcool](https://avatars.githubusercontent.com/u/42781822?v=4)](https://github.com/affcool "affcool (2 commits)")

---

Tags

dns-recordsnamesilonamesilo-apiregister-domain

### Embed Badge

![Health badge](/badges/adzon-namesilo-composer/health.svg)

```
[![Health](https://phpackages.com/badges/adzon-namesilo-composer/health.svg)](https://phpackages.com/packages/adzon-namesilo-composer)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M475](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M453](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
