Skip to content
This repository has been archived by the owner on Jun 28, 2021. It is now read-only.

hyperf/nacos-sdk-incubator

Repository files navigation

Nacos SDK

安装

composer require hyperf/nacos-sdk-incubator

使用

<?php

use Hyperf\NacosSdk\Application;
use Hyperf\NacosSdk\Config;
use Hyperf\Utils\Codec\Json;

$application = new Application(new Config([
    'username' => 'nacos',
    'password' => 'nacos',
    'guzzle_config' => [
        'headers' => [
            'charset' => 'UTF-8',
        ],
    ],
]));

$response = $application->auth->login('nacos', 'nacos');
$result = Json::decode((string) $response->getBody());

$response = $application->config->get('hyperf-service-config', 'DEFAULT_GROUP');
$result = Json::decode((string) $response->getBody());