composer require gemini/dns-cloud
创建配置
php bin/hyperf.php vendor:publish gemini/dns-cloud
各个平台都有对应的调试工具,如果不知道接口对应的事哪个 Request
,则可以到调试工具里进行查询。
安装组件
composer require alibabacloud/darabonba-openapi
composer require alibabacloud/alidns-20150109
设置环境变量
DNS_CLOUD_ALIYUN_ACCESS_KEY_ID="xxx"
DNS_CLOUD_ALIYUN_ACCESS_SECRET="xxx"
编写测试代码,我们直接把代码全部写到控制器里,开发者请按照实际情况酌情处理
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace App\Controller;
use AlibabaCloud\SDK\Alidns\V20150109\Alidns;
use AlibabaCloud\SDK\Alidns\V20150109\Models\DescribeDnsProductInstancesRequest;
use AlibabaCloud\Tea\Utils\Utils\RuntimeOptions;
use Gemini\DnsCloud\Factory;
use Hyperf\Di\Annotation\Inject;
class IndexController extends Controller
{
#[Inject]
protected Factory $factory;
public function index()
{
/** @var Alidns $client */
$client = $this->factory->get('aliyun')->client();
$describeDnsProductInstanceRequest = new DescribeDnsProductInstancesRequest();
$runtime = new RuntimeOptions([]);
$res = $client->describeDnsProductInstancesWithOptions($describeDnsProductInstanceRequest, $runtime);
return $this->response->success($res);
}
}
安装组件
composer require tencentcloud/dnspod
设置环境变量
DNS_CLOUD_TENCENT_SECRET_ID="xxx"
DNS_CLOUD_TENCENT_SECRET_KEY="xxx"
编写测试代码,我们直接把代码全部写到控制器里,开发者请按照实际情况酌情处理
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace App\Controller;
use Gemini\DnsCloud\Factory;
use Hyperf\Di\Annotation\Inject;
use TencentCloud\Dnspod\V20210323\Models\DescribeUserDetailRequest;
class IndexController extends Controller
{
#[Inject]
protected Factory $factory;
public function index()
{
/** @var Alidns $client */
$client = $this->factory->get('aliyun')->client();
$req = new DescribeUserDetailRequest();
$params = [];
$req->fromJsonString(json_encode($params));
$res = $client->DescribeUserDetail($req);
return $this->response->success($res);
}
}
安装组件
composer require cloudflare/sdk
设置环境变量
DNS_CLOUD_CLOUDFLARE_EMAIL="xxx"
DNS_CLOUD_CLOUDFLARE_API_KEY="xxx"
编写测试代码,我们直接把代码全部写到控制器里,开发者请按照实际情况酌情处理
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace App\Controller;
use Cloudflare\API\Adapter\Guzzle;
use Cloudflare\API\Endpoints\User;
use Gemini\DnsCloud\Factory;
use Hyperf\Di\Annotation\Inject;
class IndexController extends Controller
{
#[Inject]
protected Factory $factory;
public function index()
{
/** @var Guzzle $client */
$client = $this->factory->get('cloudflare')->client();
$user = new User($client);
return $this->response->success($user->getUserID());
}
}