A PHP client for the DNSimple API v2.
- dnsimple-php Packagist
- DNSimple API documentation
- DNSimple API examples repository
- DNSimple support documentation
- PHP ^8.2
-
Sign up for DNSimple – Before you begin, you need to sign up for a DNSimple account and retrieve your DNSimple API token.
-
Install – Using [Composer] is the recommended way to install. The PHP client is available via [Packagist] under the [
dnsimple/dnsimple
] package. If Composer is installed globally on your system, you can run the following in the base directory of your project to add the package as a dependency:composer require dnsimple/dnsimple
This library is a PHP client you can use to interact with the DNSimple API v2. Here are some examples.
use Dnsimple\Client;
$client = new Client("API_TOKEN");
$response = $client->identity->whoami();
$whoami = $response->getData();
$account_id = $whoami->account->id;
$response = $client->domains->listDomains($account_id);
$domains = $response->getData();
We highly recommend testing against our sandbox environment before using our production environment. This will allow you to avoid real purchases, live charges on your credit card, and reduce the chance of your running up against rate limits.
The client supports both the production and sandbox environment. To switch to sandbox pass the sandbox API host using
the base_uri
option when you construct the client:
use Dnsimple\Client;
$client = new Client("API_TOKEN", ["base_uri" => 'https://api.sandbox.dnsimple.com']);
You will need to ensure that you are using an access token created in the sandbox environment. Production tokens will not work in the sandbox environment.
## Contributing
Contibutions are welcomed. Please open an issue to discuss the changes before opening a PR. For more details on how to do development please refer to CONTRIBUTING.md
Copyright (c) 2015-2024 DNSimple Corporation. This is Free Software distributed under the MIT license.