pananames / php-api-client
Pananames APIv2 的 PHP 客户端
v1.0.2
2022-09-15 14:42 UTC
Requires
- php: ^8.0
- guzzlehttp/guzzle: ^7.4
- justinrainbow/json-schema: ^5.2
Requires (Dev)
- phpstan/phpstan: ^1.4
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.6
This package is not auto-updated.
Last update: 2024-09-13 21:57:01 UTC
README
-
API版本:1.0.0
此包引入了使用 PHP 7.x 的 Pananames 服务 APIv2。PHP 8.x 版本将很快推出。
要求
PHP 7.1 - 8.1
安装与使用
Composer
要通过 Composer 安装绑定,请在 composer.json
中添加以下内容
{
"require": {
"pananames/php-api-client": "^1.0"
}
}
或运行 composer require pananames/php-api-client
。
使用方法
<?php require_once(__DIR__ . '/vendor/autoload.php'); use Pananames\Api\Client; // Create client $client = Client::make('example95-8888-11e0-a7e8-04aafc84test'); try { // Get current balance. $response = $client->account()->getBalance(); // Get paged list of domains available in your account. $response = $client->domains()->getList(); // Get name server records. $response = $client->nameServers()->getDnsRecords('newexample.xyz'); // Get full list of available TLDs. $response = $client->other()->getTlds(); // Get current redirect URL. $response = $client->redirect()->getRedirect('newexample.xyz'); // Get active transfers in. $response = $client->transferIn()->getTransfersList(1, 20); // Init transfer out. $response = $client->transferOut()->initTransferOut('newexample.xyz'); // Get WHOIS information. $response = $client->whois()->getWhois('newexample.xyz', true); } catch (Exception $e) { echo "Error: ". $e->getMessage() . "\n"; }
以下列表介绍了您可以使用的 Pananames 主实体
- 账户
- 域名
- 域名服务器
- 其他
- 重定向
- 转入
- 转出
- Whois
所有类在 src/V2/Entities/
目录中都有详细说明。响应对象的描述可以在 src/V2/Schemas/
中找到。
您还可以在 src/Examples
中找到所有使用示例。
测试
测试在 tests/
目录中实现,并利用 PHPUnit 和 PHPStan 开发依赖项。
./vendor/bin/phpunit
./vendor/bin/phpstan analyse