Code Monkey home page Code Monkey logo

nacos's Introduction

简单的php版本nacos客户端

安装

composer require xiaosongshu/nacos

客户端提供的方法

        require_once __DIR__.'/vendor/autoload.php';
        $dataId      = 'CalculatorService';
        $group       = 'api';
        $serviceName = 'mother';
        $namespace   = 'public';
        $client      = new \Xiaosongshu\Nacos\Client('http://127.0.0.1:8848','nacos','nacos');
        /** 发布配置 */
        print_r($client->publishConfig($dataId, $group, json_encode(['name' => 'fool', 'bar' => 'ha'])));
        /** 获取配置 */
        print_r($client->getConfig($dataId, $group,'public'));
        /** 监听配置 */
        print_r($client->listenerConfig($dataId, $group, json_encode(['name' => 'fool', 'bar' => 'ha'])));
        /** 删除配置 */
        print_r($client->deleteConfig($dataId, $group));
        /** 创建服务 */
        print_r($client->createService($serviceName, $namespace, json_encode(['name' => 'tom', 'age' => 15])));
        /** 创建实例 */
        print_r($client->createInstance($serviceName, "192.168.4.110", '9504', $namespace, json_encode(['name' => 'tom', 'age' => 15]), 99, 1, false));
        /** 获取服务列表 */
        print_r($client->getServiceList($namespace));
        /** 服务详情 */
        print_r($client->getServiceDetail($serviceName, $namespace));
        /** 获取实例列表 */
        print_r($client->getInstanceList($serviceName, $namespace));
        /** 获取实例详情 */
        print_r($client->getInstanceDetail($serviceName, false, '192.168.4.110', '9504'));
        /** 更新实例健康状态 */
        print_r($client->updateInstanceHealthy($serviceName, $namespace, '192.168.4.110', '9504',false));
        /** 发送心跳 */
        print_r($client->sendBeat($serviceName, '192.168.4.110', 9504, $namespace, false, 'beat'));
        /** 移除实例*/
        print_r($client->removeInstance($serviceName, '192.168.4.110', 9504, $namespace, false));
        /** 删除服务 */
        print_r($client->removeService($serviceName, $namespace));
        

nacos's People

Contributors

2723659854 avatar

Stargazers

Cloudflying avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.