bigdevwhale / godaddy-api-wrapper
GoDaddy API的PHP包装器
1.0.11
2023-11-30 07:41 UTC
Requires
- php: >=7.2
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- phpunit/phpunit: ^9.0
README
这是一个与GoDaddy API交互的PHP包装器。此包装器简化了向GoDaddy API发起HTTP请求的过程,允许您管理您的域名、账户以及执行各种域名相关任务。
入门
在使用此包装器之前,您需要根据GoDaddy API文档中的说明创建API密钥和密钥。
安装
您可以使用Composer安装此包装器。如果您还没有安装Composer,请在此下载。
-
为您的项目创建一个新的目录,并在终端中导航到该目录。
-
在项目目录中,运行以下Composer命令以安装GoDaddy API PHP包装器
composer require bigdevwhale/godaddy-api-wrapper
-
安装完成后,您可以通过在PHP脚本中包含Composer自动加载器来使用包装器
require 'vendor/autoload.php';
请确保在PHP脚本的开头要求Composer自动加载器。
-
请确保在PHP脚本的开头要求Composer自动加载器。
// Include the Composer autoloader require 'vendor/autoload.php'; // Initialize the GoDaddyAPI with your API Key and Secret for the test environment $apiKey = 'your-test-api-key'; $apiSecret = 'your-test-api-secret'; // Set the isProduction flag to false to use the test environment $isProduction = false; // Create an instance of GoDaddyAPI for the test environment $goDaddyAPI = new \GoDaddyAPI\GoDaddyAPI($apiKey, $apiSecret, $isProduction); // Access various API endpoints using the provided methods $abuseRequest = $goDaddyAPI->abuse(); $aftermarketRequest = $goDaddyAPI->aftermarket(); $agreementsRequest = $goDaddyAPI->agreements(); $certificatesRequest = $goDaddyAPI->certificates(); $countriesRequest = $goDaddyAPI->countries(); $domainsRequest = $goDaddyAPI->domains(); $ordersRequest = $goDaddyAPI->orders(); $parkingRequest = $goDaddyAPI->parking(); $shoppersRequest = $goDaddyAPI->shoppers(); $subscriptionsRequest = $goDaddyAPI->subscriptions(); // Use the API requests to perform specific actions // For example, list all abuse tickets try { $abuseTickets = $abuseRequest->getTickets(); // Process the $abuseTickets response print_r($abuseTickets); } catch (\GoDaddyAPI\Exceptions\GoDaddyAPIException $e) { echo 'Error: ' . $e->getMessage(); }
有关详细的API参考和可用端点,请参阅官方的GoDaddy API文档。
配置
您可以通过在GoDaddyApiClient构造函数中设置$ isProduction参数来在GoDaddyApiClient构造函数中配置基本URL(生产环境或测试环境)。
贡献
我们欢迎贡献!请随意创建问题、提交拉取请求或对此包装器进行改进。
许可
此GoDaddy API PHP包装器受MIT许可证许可 - 有关详细信息,请参阅LICENSE文件。