zhwei/nacos-sdk-php

Nacos PHP 客户端

dev-master 2019-04-20 02:00 UTC

This package is auto-updated.

Last update: 2024-08-29 04:54:49 UTC


README

是 Nacos OpenAPI 的 PHP 实现。

查看:https://nacos.io/zh-cn/docs/open-API.html

要求

  • PHP ^7.0

安装

composer require zhwei/nacos-sdk-php

入门指南

use Nacos\NacosClient;

$client = new NacosClient('localhost', 8848);

$dataId = 'abc';
$group = 'test-group';
$value = $client->getConfig($dataId, $group);

API

请求选项

  • setNamespace
    • string $namespace
  • setTimeout
    • int $timeout

配置 API

  • getConfig
    • string $dataId
    • string $group = NacosClient::DEFAULT_GROUP
  • publishConfig
    • string $dataId
    • string $group
    • $content
  • removeConfig
    • string $dataId
    • string $group = NacosClient::DEFAULT_GROUP
  • listenConfig
    • array $configs
    • int $timeout = 30

命名 API

  • createInstance
    • ServiceInstance $instance
  • deleteInstance
    • string $serviceName
    • string $ip
    • int $port
    • string $clusterName = null
    • string $namespaceId = null
  • updateInstance
    • ServiceInstance $instance
  • getInstanceList
    • string $serviceName
    • string $namespaceId = null
    • array $clusters = []
    • bool $healthyOnly = false
  • getInstance
    • string $serviceName
    • string $ip
    • int $port
    • string $namespaceId = null
    • string $cluster = null
    • bool $healthyOnly = false
  • sendInstanceBeat
    • string $serviceName
    • BeatInfo $beat