cocoyo/nacos

nacos hyperf sdk

v1.0.0 2020-05-22 03:43 UTC

This package is auto-updated.

Last update: 2021-09-22 06:43:15 UTC


README

Nacos服务管理平台 hyperf 框架 SDK

安装

composer require cocoyo/nacos

使用

  • 获取对应 nacos 客户端:
use Cocoyo\Nacos\Config;
use Hyperf\Guzzle\ClientFactory;
use Hyperf\Utils\ApplicationContext;

$container = ApplicationContext::getContainer();
$clientFactory = $container->get(ClientFactory::class);

$consulServer = 'http://127.0.0.1:8848';
$config = new Config(function () use ($clientFactory, $consulServer) {
    return $clientFactory->create([
        'base_uri' => $consulServer,
    ]);
});

$config->publish($options);

更多示例请查看单元测试