Download the PHP package greenreader9/namesilo-php-api without Composer

On this page you can find all versions of the php package greenreader9/namesilo-php-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package namesilo-php-api

NameSilo PHP API Wrapper

PHP Wrapper for the NameSilo API

About Me

This PHP class is an API wrapper and supports all current NameSilo function as of September, 2024 (That's actually a lie, everything except for the bidAuctions call is supported)

This class was created for private use, but has been released under the MIT license for you to enjoy, because open-source is awesome

That said, it should work, but I don't gartentee it. Open a Issue or PR to fix any bugs.

Install Me

Install via Composer:

composer require greenreader9/namesilo-php-api

Or grab the /src/NameSiloAPI.php file, that works too

Use Me

  1. Install Me
  2. Initiate Me:
    
    require_once __DIR__.'/vendor/autoload.php';
    use Greenreader9\NameSiloAPI;

$api = new NameSiloAPI('your-api-key', 'application-name', 'bulk', 'ote');

`new NameSiloAPI($apiKey, $UserAgent, $BulkORnormal, $SandboxURL)`

`apiKey` is your NameSilo API key. Don't share with others

`UserAgent` is the name of your application. Keep it short and descriptive

`BulkORnormal` (Optional) Set to `"bulk"` to use the [BulkAPI](https://www.namesilo.com/support/v2/articles/account-options/api-automated-batch), `null` or `"normal"` to use the normal API

`SandboxURL` (Optional) Set to `false` or omit for production use. Setting to any other value will set your API call to https://`VALUE`/namesilo.com/`BULK/NORMAL`

> TIP: All commands can use either API type except the `registerDomainDrop` command, which requires the bulk API

> TIP: Sandbox mode does not work during drop/catch times, and does not work with the `registerDomainDrop` command

3. Call a function:
~~~php
$apicall = $api->listDomains();

How to get function name?

Vist the API docs: https://www.namesilo.com/api-reference

Go to "Available Operations"

Find the API call you want to make and copy the part of the URL shown below

The URL shown in the docs: https://www.namesilo.com/api/getPrices?version=1&type=xml&key=12345

The part you copy: getPrices (Otherwise known as the part right after the final slash (/)

How to get the function paramaters?

Vist the API docs: https://www.namesilo.com/api-reference

Go to "Available Operations"

Find the API call you want to make and scroll to the Request Parameters section

The order in which the params are listed on the API page is the order this wrapper accept them (Easy, right?)

To omit a paramater

Two ways you can do this:

  1. Just don't send it in. If the function has 1 optional param, and no required ones, just do $api->func()

  2. Set it to null. $api->func('ThisIsNeeded', null, 'ThisIsAlsoNeeded')

What Validation is done?

Pretty much none. It does check that you used the bulkAPI for registerDomainDrop, and that you are not trying to call the bidAuctions function. It also requires that you send in all paramaters that NameSilo marks as always required.

Any other mistakes are sent to the NameSilo API, and it will (hopefully) return a helpful error message. See API Errors Here -> Click Responce Codes

How to read the responce?

You get the responce as a PHP object (No, I won't provide you support with parsing it, ask Google or consult a PHP book)

Example for the listDomains call:

object(SimpleXMLElement)#3 (2) {
  ["request"]=> object(SimpleXMLElement)#2 (2) {
    ["operation"]=> string(11) "listDomains"
    ["ip"]=> string(13) "0.0.0.0"
  }
  ["reply"]=> object(SimpleXMLElement)#4 (3) {
    ["code"]=> string(3) "300"
    ["detail"]=> string(7) "success"
    ["domains"]=> object(SimpleXMLElement)#5 (1) {
      ["domain"]=> array(5) {
        [0]=> string(14) "domain1.com"
        [1]=> string(14) "domain2.net"
        [2]=> string(10) "domain3.top"
        [3]=> string(14) "domain4.net"
        [4]=> string(17) "domain5.com"
      }
    }
  }
}

And the code that made that responce:

See more about the responce for the API call you are making by reading the NameSilo API docs

Get more information about your request

Most of these were used for debugging, but I left them in case you find them useful (Or if you need to debug it yourself)

// returns last HTTP code, or NULL (If no API requests have been made)
$api->getHTTPCode();

// returns last HTTP body response, or NULL (If no API requests have been made)
$api->getLastResult();

// returns last endpoint called, or NULL (If no API requests have been made)
$api->getLastCall();

// returns last URL called, or NULL (If no API requests have been made) --WARNING:::: EXPOSES PRIVATE API KEY!!!!
// NEVER USE IN PRODUCTION!
$api->getLastURL();

Make a PR

Obviously there is not much here in terms of code. To make a PR, just fix the bug / add the endpoint / do what you want to do, then open a PR and type the following:

  1. What you did (Added the new API endpoint someEndpoint)
  2. Where I can verify your work, if needed (https://www.namesilo.com/api-reference#cat/some-endpoint)
  3. A programming joke (Not neceasry, but humor is generally a good thing)
  4. Anything else you feel like sharing

Get Support

I will provide support to a reasonable degree around this class. Open an Issue to get support.

If your question seems more appropriate for the NameSilo team (Like adding / changing endpoints, etc), ask them instead. I only created the wrapper, not the actual API

NameSilo support can be found here: https://www.namesilo.com/support/v2


All versions of namesilo-php-api with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package greenreader9/namesilo-php-api contains the following files

Loading the files please wait ....